home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / gjr / debug.lha / debugging.tex < prev   
LaTeX Document  |  1989-01-03  |  30.8 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: LaTeX Document (document/latex).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 63 68 61 70 74 65 72 | 7b 44 65 62 75 67 67 69 |\chapter|{Debuggi|
|00000010| 6e 67 7d 0a 5c 6c 61 62 | 65 6c 7b 65 72 72 6f 72 |ng}.\lab|el{error|
|00000020| 73 79 73 74 65 6d 7d 0a | 5c 6c 61 62 65 6c 7b 64 |system}.|\label{d|
|00000030| 65 62 75 67 67 69 6e 67 | 7d 0a 0a 49 74 20 77 69 |ebugging|}..It wi|
|00000040| 6c 6c 20 62 65 63 6f 6d | 65 20 61 70 70 61 72 65 |ll becom|e appare|
|00000050| 6e 74 20 74 6f 20 79 6f | 75 20 6d 61 6e 79 20 74 |nt to yo|u many t|
|00000060| 69 6d 65 73 20 64 75 72 | 69 6e 67 20 61 20 70 72 |imes dur|ing a pr|
|00000070| 6f 67 72 61 6d 27 73 0a | 65 76 6f 6c 75 74 69 6f |ogram's.|evolutio|
|00000080| 6e 20 74 68 61 74 20 74 | 68 65 20 70 72 6f 67 72 |n that t|he progr|
|00000090| 61 6d 20 69 73 20 6e 6f | 74 20 65 6e 74 69 72 65 |am is no|t entire|
|000000a0| 6c 79 20 72 69 67 68 74 | 2e 20 20 49 6e 73 74 65 |ly right|. Inste|
|000000b0| 61 64 20 6f 66 20 62 6c | 61 6d 69 6e 67 0a 74 68 |ad of bl|aming.th|
|000000c0| 65 20 70 72 6f 67 72 61 | 6d 20 66 6f 72 20 74 68 |e progra|m for th|
|000000d0| 65 73 65 20 66 61 75 6c | 74 73 2c 20 73 74 72 61 |ese faul|ts, stra|
|000000e0| 6e 67 65 20 63 72 65 61 | 74 75 72 65 73 20 63 61 |nge crea|tures ca|
|000000f0| 6c 6c 65 64 20 62 75 67 | 73 20 61 72 65 0a 62 6c |lled bug|s are.bl|
|00000100| 61 6d 65 64 2e 20 20 49 | 6e 20 74 68 69 73 20 77 |amed. I|n this w|
|00000110| 61 79 2c 20 74 68 65 20 | 70 72 6f 67 72 61 6d 6d |ay, the |programm|
|00000120| 65 72 20 72 65 6d 61 69 | 6e 73 20 66 72 65 65 20 |er remai|ns free |
|00000130| 6f 66 20 67 75 69 6c 74 | 2e 20 20 45 72 72 6f 72 |of guilt|. Error|
|00000140| 73 20 61 6e 64 0a 69 6e | 63 6f 72 72 65 63 74 20 |s and.in|correct |
|00000150| 72 65 73 75 6c 74 73 20 | 61 72 65 20 73 75 72 65 |results |are sure|
|00000160| 20 73 69 67 6e 73 20 74 | 68 61 74 20 62 75 67 73 | signs t|hat bugs|
|00000170| 20 6c 75 72 6b 20 69 6e | 73 69 64 65 20 61 20 70 | lurk in|side a p|
|00000180| 72 6f 67 72 61 6d 2c 20 | 66 6f 72 0a 74 68 65 20 |rogram, |for.the |
|00000190| 62 75 67 73 20 63 61 75 | 73 65 20 74 68 65 20 61 |bugs cau|se the a|
|000001a0| 62 65 72 72 61 6e 74 20 | 62 65 68 61 76 69 6f 72 |berrant |behavior|
|000001b0| 2e 0a 0a 44 65 62 75 67 | 67 69 6e 67 20 75 73 75 |...Debug|ging usu|
|000001c0| 61 6c 6c 79 20 64 65 70 | 65 6e 64 73 20 6f 6e 20 |ally dep|ends on |
|000001d0| 65 6d 70 69 72 69 63 61 | 6c 20 74 65 73 74 69 6e |empirica|l testin|
|000001e0| 67 2c 20 74 68 75 73 20 | 69 74 20 63 61 6e 0a 73 |g, thus |it can.s|
|000001f0| 65 72 76 65 20 74 6f 20 | 72 65 69 6e 66 6f 72 63 |erve to |reinforc|
|00000200| 65 20 74 68 65 20 70 72 | 6f 67 72 61 6d 6d 65 72 |e the pr|ogrammer|
|00000210| 27 73 20 62 65 6c 69 65 | 66 20 69 6e 20 74 68 65 |'s belie|f in the|
|00000220| 20 63 6f 72 72 65 63 74 | 6e 65 73 73 20 6f 66 20 | correct|ness of |
|00000230| 68 69 73 0a 70 72 6f 67 | 72 61 6d 2c 20 61 6e 64 |his.prog|ram, and|
|00000240| 20 69 74 20 63 61 6e 20 | 61 69 64 20 69 6e 20 63 | it can |aid in c|
|00000250| 6f 72 72 65 63 74 69 6f | 6e 20 6f 66 20 61 20 70 |orrectio|n of a p|
|00000260| 72 6f 67 72 61 6d 20 77 | 68 69 63 68 20 69 73 20 |rogram w|hich is |
|00000270| 6e 6f 74 0a 62 65 68 61 | 76 69 6e 67 20 61 73 20 |not.beha|ving as |
|00000280| 65 78 70 65 63 74 65 64 | 2c 20 62 75 74 20 69 74 |expected|, but it|
|00000290| 20 63 61 6e 6e 6f 74 20 | 7b 5c 65 6d 20 70 72 6f | cannot |{\em pro|
|000002a0| 76 65 7d 20 74 68 61 74 | 20 74 68 65 20 70 72 6f |ve} that| the pro|
|000002b0| 67 72 61 6d 20 69 73 20 | 63 6f 72 72 65 63 74 2e |gram is |correct.|
|000002c0| 0a 49 66 20 74 68 65 20 | 70 72 6f 67 72 61 6d 20 |.If the |program |
|000002d0| 73 75 63 63 65 65 64 73 | 20 64 75 72 69 6e 67 20 |succeeds| during |
|000002e0| 64 65 62 75 67 67 69 6e | 67 2c 20 74 68 65 72 65 |debuggin|g, there|
|000002f0| 20 6d 61 79 20 62 65 20 | 73 6f 6d 65 0a 79 65 74 | may be |some.yet|
|00000300| 2d 74 6f 2d 62 65 2d 75 | 6e 63 6f 76 65 72 65 64 |-to-be-u|ncovered|
|00000310| 20 62 75 67 20 6c 75 72 | 6b 69 6e 67 20 77 69 74 | bug lur|king wit|
|00000320| 68 69 6e 2c 20 77 61 69 | 74 69 6e 67 20 74 6f 20 |hin, wai|ting to |
|00000330| 73 68 6f 77 20 69 74 73 | 65 6c 66 20 69 6e 20 73 |show its|elf in s|
|00000340| 6f 6d 65 0a 6c 61 74 65 | 72 20 72 75 6e 2e 20 20 |ome.late|r run. |
|00000350| 54 68 65 20 62 65 73 74 | 20 70 72 6f 74 65 63 74 |The best| protect|
|00000360| 69 6f 6e 20 61 67 61 69 | 6e 73 74 20 70 72 6f 67 |ion agai|nst prog|
|00000370| 72 61 6d 20 62 75 67 73 | 20 69 73 20 61 20 70 72 |ram bugs| is a pr|
|00000380| 6f 67 72 61 6d 20 74 68 | 61 74 0a 69 73 20 77 65 |ogram th|at.is we|
|00000390| 6c 6c 20 74 68 6f 75 67 | 68 74 20 6f 75 74 20 61 |ll thoug|ht out a|
|000003a0| 6e 64 20 63 6c 65 61 72 | 6c 79 20 73 65 74 20 64 |nd clear|ly set d|
|000003b0| 6f 77 6e 20 69 6e 20 63 | 6f 64 65 2e 0a 0a 53 63 |own in c|ode...Sc|
|000003c0| 68 65 6d 65 20 70 72 6f | 76 69 64 65 73 20 73 65 |heme pro|vides se|
|000003d0| 76 65 72 61 6c 20 66 65 | 61 74 75 72 65 73 20 74 |veral fe|atures t|
|000003e0| 6f 20 61 69 64 20 69 6e | 20 64 65 62 75 67 67 69 |o aid in| debuggi|
|000003f0| 6e 67 20 70 72 6f 67 72 | 61 6d 73 2e 20 20 41 6d |ng progr|ams. Am|
|00000400| 6f 6e 67 0a 74 68 65 73 | 65 20 61 72 65 20 74 68 |ong.thes|e are th|
|00000410| 65 20 61 62 69 6c 69 74 | 79 20 74 6f 20 7b 5c 74 |e abilit|y to {\t|
|00000420| 74 20 74 72 61 63 65 7d | 20 74 68 65 20 65 78 65 |t trace}| the exe|
|00000430| 63 75 74 69 6f 6e 20 6f | 66 20 61 20 70 72 6f 63 |cution o|f a proc|
|00000440| 65 64 75 72 65 2c 20 74 | 68 65 0a 61 62 69 6c 69 |edure, t|he.abili|
|00000450| 74 79 20 74 6f 20 65 78 | 61 6d 69 6e 65 20 74 68 |ty to ex|amine th|
|00000460| 65 20 63 75 72 72 65 6e | 74 20 65 6e 76 69 72 6f |e curren|t enviro|
|00000470| 6e 6d 65 6e 74 2c 20 61 | 6e 64 20 74 68 65 20 61 |nment, a|nd the a|
|00000480| 62 69 6c 69 74 79 20 74 | 6f 20 73 65 74 0a 7b 5c |bility t|o set.{\|
|00000490| 65 6d 20 62 72 65 61 6b | 70 6f 69 6e 74 73 7d 2e |em break|points}.|
|000004a0| 20 20 46 72 6f 6d 20 61 | 20 62 72 65 61 6b 70 6f | From a| breakpo|
|000004b0| 69 6e 74 2c 20 79 6f 75 | 20 63 61 6e 20 65 78 61 |int, you| can exa|
|000004c0| 6d 69 6e 65 20 74 68 65 | 20 72 65 63 65 6e 74 0a |mine the| recent.|
|000004d0| 70 72 6f 63 65 73 73 20 | 68 69 73 74 6f 72 79 20 |process |history |
|000004e0| 6f 66 20 79 6f 75 72 20 | 70 72 6f 67 72 61 6d 2e |of your |program.|
|000004f0| 0a 0a 42 75 67 73 20 61 | 72 65 20 73 6f 6d 65 74 |..Bugs a|re somet|
|00000500| 69 6d 65 73 20 64 65 74 | 65 63 74 65 64 20 62 79 |imes det|ected by|
|00000510| 20 74 68 65 20 6f 63 63 | 75 72 72 65 6e 63 65 20 | the occ|urrence |
|00000520| 6f 66 20 61 6e 20 65 72 | 72 6f 72 20 77 68 69 6c |of an er|ror whil|
|00000530| 65 20 74 68 65 0a 70 72 | 6f 67 72 61 6d 20 69 73 |e the.pr|ogram is|
|00000540| 20 72 75 6e 6e 69 6e 67 | 2e 20 20 57 68 65 6e 20 | running|. When |
|00000550| 53 63 68 65 6d 65 20 65 | 6e 63 6f 75 6e 74 65 72 |Scheme e|ncounter|
|00000560| 73 20 61 6e 20 65 72 72 | 6f 72 2c 20 65 78 65 63 |s an err|or, exec|
|00000570| 75 74 69 6f 6e 20 69 73 | 0a 61 62 72 75 70 74 6c |ution is|.abruptl|
|00000580| 79 20 68 61 6c 74 65 64 | 2c 20 79 6f 75 20 61 72 |y halted|, you ar|
|00000590| 65 20 6e 6f 74 69 66 69 | 65 64 2c 20 61 6e 64 20 |e notifi|ed, and |
|000005a0| 79 6f 75 20 61 72 65 20 | 67 69 76 65 6e 20 74 68 |you are |given th|
|000005b0| 65 63 68 6f 69 63 65 20 | 6f 66 0a 65 69 74 68 65 |echoice |of.eithe|
|000005c0| 72 20 61 62 6f 72 74 69 | 6e 67 20 66 72 6f 6d 20 |r aborti|ng from |
|000005d0| 74 68 65 20 65 72 72 6f | 72 2c 20 6f 72 20 65 6e |the erro|r, or en|
|000005e0| 74 65 72 69 6e 67 0a 61 | 6e 20 7b 5c 65 6d 20 65 |tering.a|n {\em e|
|000005f0| 72 72 6f 72 20 72 65 61 | 64 2d 65 76 61 6c 2d 70 |rror rea|d-eval-p|
|00000600| 72 69 6e 74 2d 6c 6f 6f | 70 7d 2e 0a 28 53 65 65 |rint-loo|p}..(See|
|00000610| 20 73 65 63 74 69 6f 6e | 7e 5c 72 65 66 7b 72 65 | section|~\ref{re|
|00000620| 70 2d 6c 6f 6f 70 73 7d | 29 2e 20 20 48 65 72 65 |p-loops}|). Here|
|00000630| 20 69 73 20 61 0a 74 79 | 70 69 63 61 6c 20 65 72 | is a.ty|pical er|
|00000640| 72 6f 72 20 72 65 73 70 | 6f 6e 73 65 3a 0a 5c 62 |ror resp|onse:.\b|
|00000650| 65 67 69 6e 7b 73 63 68 | 65 6d 65 7d 0a 28 2b 20 |egin{sch|eme}.(+ |
|00000660| 31 20 27 61 29 0a 0a 49 | 6c 6c 65 67 61 6c 20 64 |1 'a)..I|llegal d|
|00000670| 61 74 75 6d 20 69 6e 20 | 73 65 63 6f 6e 64 20 61 |atum in |second a|
|00000680| 72 67 75 6d 65 6e 74 20 | 70 6f 73 69 74 69 6f 6e |rgument |position|
|00000690| 20 41 0a 57 69 74 68 69 | 6e 20 70 72 6f 63 65 64 | A.Withi|n proced|
|000006a0| 75 72 65 20 5c 23 7b 7d | 5b 50 52 49 4d 49 54 49 |ure \#{}|[PRIMITI|
|000006b0| 56 45 20 50 52 4f 43 45 | 44 55 52 45 20 5c 26 7b |VE PROCE|DURE \&{|
|000006c0| 7d 2b 5d 0a 54 68 65 72 | 65 20 69 73 20 6e 6f 20 |}+].Ther|e is no |
|000006d0| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 20 61 76 61 69 |environm|ent avai|
|000006e0| 6c 61 62 6c 65 3b 0a 75 | 73 69 6e 67 20 74 68 65 |lable;.u|sing the|
|000006f0| 20 63 75 72 72 65 6e 74 | 20 72 65 61 64 2d 65 76 | current| read-ev|
|00000700| 61 6c 2d 70 72 69 6e 74 | 20 65 6e 76 69 72 6f 6e |al-print| environ|
|00000710| 6d 65 6e 74 2e 0a 5c 65 | 6e 64 7b 73 63 68 65 6d |ment..\e|nd{schem|
|00000720| 65 7d 0a 0a 54 68 65 20 | 65 72 72 6f 72 20 6d 65 |e}..The |error me|
|00000730| 73 73 61 67 65 2d 2d 2d | 61 20 63 6f 6e 63 69 73 |ssage---|a concis|
|00000740| 65 20 64 65 73 63 72 69 | 70 74 69 6f 6e 20 6f 66 |e descri|ption of|
|00000750| 20 74 68 65 20 65 72 72 | 6f 72 2d 2d 2d 69 73 20 | the err|or---is |
|00000760| 74 68 65 20 66 69 72 73 | 74 0a 74 68 69 6e 67 20 |the firs|t.thing |
|00000770| 70 72 69 6e 74 65 64 2e | 20 20 49 6e 20 74 68 69 |printed.| In thi|
|00000780| 73 20 63 61 73 65 2c 20 | 74 68 65 20 65 72 72 6f |s case, |the erro|
|00000790| 72 20 77 61 73 20 61 20 | 62 61 64 20 61 72 67 75 |r was a |bad argu|
|000007a0| 6d 65 6e 74 3a 20 74 68 | 65 0a 73 79 6d 62 6f 6c |ment: th|e.symbol|
|000007b0| 20 7b 5c 74 74 20 61 7d | 20 74 6f 20 74 68 65 20 | {\tt a}| to the |
|000007c0| 7b 5c 74 74 20 2b 7d 20 | 70 72 6f 63 65 64 75 72 |{\tt +} |procedur|
|000007d0| 65 2e 0a 0a 54 68 65 20 | 65 72 72 6f 72 20 6d 65 |e...The |error me|
|000007e0| 73 73 61 67 65 20 69 73 | 20 73 6f 6d 65 74 69 6d |ssage is| sometim|
|000007f0| 65 73 20 66 6f 6c 6c 6f | 77 65 64 20 62 79 20 69 |es follo|wed by i|
|00000800| 6e 66 6f 72 6d 61 74 69 | 6f 6e 20 61 62 6f 75 74 |nformati|on about|
|00000810| 20 74 68 65 0a 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 | the.env|ironment|
|00000820| 20 69 6e 20 77 68 69 63 | 68 20 74 68 65 20 65 72 | in whic|h the er|
|00000830| 72 6f 72 20 6f 63 63 75 | 72 72 65 64 2e 20 20 54 |ror occu|rred. T|
|00000840| 68 69 73 20 69 73 20 75 | 73 65 66 75 6c 20 62 65 |his is u|seful be|
|00000850| 63 61 75 73 65 20 74 68 | 65 0a 64 65 62 75 67 67 |cause th|e.debugg|
|00000860| 65 72 20 69 6e 63 6c 75 | 64 65 73 20 73 6f 6d 65 |er inclu|des some|
|00000870| 20 61 64 76 61 6e 63 65 | 64 20 66 65 61 74 75 72 | advance|d featur|
|00000880| 65 73 20 74 68 61 74 20 | 61 6c 6c 6f 77 20 79 6f |es that |allow yo|
|00000890| 75 20 74 6f 20 70 72 6f | 62 65 20 6f 72 0a 6d 6f |u to pro|be or.mo|
|000008a0| 64 69 66 79 20 74 68 65 | 20 65 6e 76 69 72 6f 6e |dify the| environ|
|000008b0| 6d 65 6e 74 2e 20 20 28 | 53 65 65 20 73 65 63 74 |ment. (|See sect|
|000008c0| 69 6f 6e 73 20 5c 72 65 | 66 7b 77 68 65 72 65 73 |ions \re|f{wheres|
|000008d0| 65 63 74 69 6f 6e 7d 20 | 61 6e 64 0a 5c 72 65 66 |ection} |and.\ref|
|000008e0| 7b 64 65 62 75 67 73 65 | 63 74 69 6f 6e 7d 2e 29 |{debugse|ction}.)|
|000008f0| 20 20 53 6f 6d 65 74 69 | 6d 65 73 2c 20 61 73 20 | Someti|mes, as |
|00000900| 69 6e 20 74 68 65 20 65 | 78 61 6d 70 6c 65 20 61 |in the e|xample a|
|00000910| 62 6f 76 65 2c 20 74 68 | 65 20 73 79 73 74 65 6d |bove, th|e system|
|00000920| 0a 77 69 6c 6c 20 74 65 | 6c 6c 20 79 6f 75 20 74 |.will te|ll you t|
|00000930| 68 61 74 20 6e 6f 20 65 | 6e 76 69 72 6f 6e 6d 65 |hat no e|nvironme|
|00000940| 6e 74 0a 77 61 73 20 66 | 6f 75 6e 64 20 61 74 20 |nt.was f|ound at |
|00000950| 61 6c 6c 2c 20 77 68 69 | 63 68 20 6d 65 61 6e 73 |all, whi|ch means|
|00000960| 20 74 68 61 74 20 79 6f | 75 20 61 72 65 20 69 6e | that yo|u are in|
|00000970| 20 74 68 65 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 | the env|ironment|
|00000980| 20 6f 66 20 74 68 65 0a | 70 72 65 76 69 6f 75 73 | of the.|previous|
|00000990| 20 52 45 50 20 6c 6f 6f | 70 2e 0a 0a 49 66 20 79 | REP loo|p...If y|
|000009a0| 6f 75 20 63 68 6f 6f 73 | 65 20 6e 6f 74 20 74 6f |ou choos|e not to|
|000009b0| 20 61 62 6f 72 74 2c 20 | 74 68 65 20 6d 6f 64 65 | abort, |the mode|
|000009c0| 20 6c 69 6e 65 20 69 6e | 66 6f 72 6d 61 74 69 6f | line in|formatio|
|000009d0| 6e 20 28 69 6e 64 69 63 | 61 74 69 6e 67 0a 53 63 |n (indic|ating.Sc|
|000009e0| 68 65 6d 65 27 73 20 73 | 74 61 74 75 73 29 20 77 |heme's s|tatus) w|
|000009f0| 69 6c 6c 20 63 68 61 6e | 67 65 20 66 72 6f 6d 0a |ill chan|ge from.|
|00000a00| 5c 62 65 67 69 6e 7b 73 | 63 68 65 6d 65 7d 0a 49 |\begin{s|cheme}.I|
|00000a10| 20 31 20 5c 76 65 72 62 | 7c 5b 7c 52 45 50 20 4c | 1 \verb||[|REP L|
|00000a20| 6f 6f 70 5c 76 65 72 62 | 7c 5d 7c 0a 5c 65 6e 64 |oop\verb||]|.\end|
|00000a30| 7b 73 63 68 65 6d 65 7d | 0a 74 6f 0a 5c 62 65 67 |{scheme}|.to.\beg|
|00000a40| 69 6e 7b 73 63 68 65 6d | 65 7d 0a 49 20 32 20 5c |in{schem|e}.I 2 \|
|00000a50| 76 65 72 62 7c 5b 7c 45 | 72 72 6f 72 5c 76 65 72 |verb|[|E|rror\ver|
|00000a60| 62 7c 5d 7c 0a 5c 65 6e | 64 7b 73 63 68 65 6d 65 |b|]|.\en|d{scheme|
|00000a70| 7d 0a 5c 6e 6f 69 6e 64 | 65 6e 74 0a 74 6f 20 69 |}.\noind|ent.to i|
|00000a80| 6e 64 69 63 61 74 65 20 | 74 68 61 74 20 79 6f 75 |ndicate |that you|
|00000a90| 20 61 72 65 20 69 6e 20 | 61 6e 20 65 72 72 6f 72 | are in |an error|
|00000aa0| 20 52 45 50 20 6c 6f 6f | 70 2e 20 20 54 68 65 20 | REP loo|p. The |
|00000ab0| 6e 75 6d 62 65 72 20 32 | 20 73 69 67 6e 61 6c 73 |number 2| signals|
|00000ac0| 0a 74 68 61 74 20 74 68 | 69 73 20 52 45 50 20 6c |.that th|is REP l|
|00000ad0| 6f 6f 70 20 69 73 20 73 | 75 62 6f 72 64 69 6e 61 |oop is s|ubordina|
|00000ae0| 74 65 20 74 6f 20 61 20 | 6c 65 76 65 6c 20 31 20 |te to a |level 1 |
|00000af0| 28 74 6f 70 20 6c 65 76 | 65 6c 29 20 52 45 50 20 |(top lev|el) REP |
|00000b00| 6c 6f 6f 70 2e 0a 53 65 | 65 20 73 65 63 74 69 6f |loop..Se|e sectio|
|00000b10| 6e 73 0a 5c 72 65 66 7b | 72 65 70 2d 6c 6f 6f 70 |ns.\ref{|rep-loop|
|00000b20| 73 7d 20 61 6e 64 20 5c | 72 65 66 7b 65 72 72 6f |s} and \|ref{erro|
|00000b30| 72 72 65 70 7d 20 66 6f | 72 20 69 6e 66 6f 72 6d |rrep} fo|r inform|
|00000b40| 61 74 69 6f 6e 20 6f 6e | 20 52 45 50 20 6c 6f 6f |ation on| REP loo|
|00000b50| 70 73 2e 0a 0a 49 66 20 | 79 6f 75 20 64 6f 20 63 |ps...If |you do c|
|00000b60| 68 6f 6f 73 65 20 74 6f | 20 61 62 6f 72 74 2c 20 |hoose to| abort, |
|00000b70| 79 6f 75 20 77 69 6c 6c | 20 72 65 74 75 72 6e 20 |you will| return |
|00000b80| 74 6f 20 74 68 65 20 70 | 72 65 76 69 6f 75 73 20 |to the p|revious |
|00000b90| 52 45 50 20 6c 6f 6f 70 | 0a 61 6e 64 20 79 6f 75 |REP loop|.and you|
|00000ba0| 20 63 61 6e 20 74 72 79 | 20 61 6e 6f 74 68 65 72 | can try| another|
|00000bb0| 20 65 78 70 72 65 73 73 | 69 6f 6e 2e 20 20 42 65 | express|ion. Be|
|00000bc0| 67 69 6e 6e 69 6e 67 20 | 70 72 6f 67 72 61 6d 6d |ginning |programm|
|00000bd0| 65 72 73 20 68 61 76 65 | 20 61 0a 74 65 6e 64 65 |ers have| a.tende|
|00000be0| 6e 63 79 20 74 6f 20 61 | 75 74 6f 6d 61 74 69 63 |ncy to a|utomatic|
|00000bf0| 61 6c 6c 79 20 61 62 6f | 72 74 20 61 73 20 73 6f |ally abo|rt as so|
|00000c00| 6f 6e 20 61 73 20 61 6e | 20 65 72 72 6f 72 20 69 |on as an| error i|
|00000c10| 73 0a 65 6e 63 6f 75 6e | 74 65 72 65 64 2e 5c 66 |s.encoun|tered.\f|
|00000c20| 6f 6f 74 6e 6f 74 65 7b | 54 68 69 73 20 69 73 20 |ootnote{|This is |
|00000c30| 73 69 6d 69 6c 61 72 20 | 74 6f 20 74 68 65 20 62 |similar |to the b|
|00000c40| 65 68 61 76 69 6f 72 20 | 6f 66 20 63 68 69 6c 64 |ehavior |of child|
|00000c50| 72 65 6e 0a 77 72 69 74 | 69 6e 67 20 6f 72 20 64 |ren.writ|ing or d|
|00000c60| 72 61 77 69 6e 67 2c 20 | 77 68 6f 20 77 69 6c 6c |rawing, |who will|
|00000c70| 20 6f 72 64 69 6e 61 72 | 79 20 63 72 75 6d 70 6c | ordinar|y crumpl|
|00000c80| 65 20 75 70 20 74 68 65 | 20 70 61 70 65 72 20 61 |e up the| paper a|
|00000c90| 6e 64 20 73 74 61 72 74 | 0a 6f 76 65 72 20 61 67 |nd start|.over ag|
|00000ca0| 61 69 6e 20 61 73 20 73 | 6f 6f 6e 20 61 73 20 74 |ain as s|oon as t|
|00000cb0| 68 65 79 20 6d 61 6b 65 | 20 61 20 6d 69 73 74 61 |hey make| a mista|
|00000cc0| 6b 65 2e 20 20 50 72 65 | 73 75 6d 61 62 6c 79 2c |ke. Pre|sumably,|
|00000cd0| 20 74 68 65 20 65 72 72 | 6f 72 0a 74 72 69 67 67 | the err|or.trigg|
|00000ce0| 65 72 73 20 73 6f 6d 65 | 20 6b 69 6e 64 20 6f 66 |ers some| kind of|
|00000cf0| 20 60 60 61 62 6f 72 74 | 27 27 20 72 65 61 63 74 | ``abort|'' react|
|00000d00| 69 6f 6e 20 77 68 6f 73 | 65 20 67 6f 61 6c 20 69 |ion whos|e goal i|
|00000d10| 73 20 74 6f 20 72 65 74 | 75 72 6e 20 74 68 65 0a |s to ret|urn the.|
|00000d20| 63 6f 67 6e 69 74 69 76 | 65 20 70 72 6f 63 65 73 |cognitiv|e proces|
|00000d30| 73 20 74 6f 20 61 20 73 | 69 6d 70 6c 65 20 6b 6e |s to a s|imple kn|
|00000d40| 6f 77 6e 20 73 74 61 74 | 65 20 61 73 20 72 61 70 |own stat|e as rap|
|00000d50| 69 64 6c 79 20 61 73 20 | 70 6f 73 73 69 62 6c 65 |idly as |possible|
|00000d60| 2e 20 20 4f 6e 65 0a 6f | 66 20 74 68 65 20 75 73 |. One.o|f the us|
|00000d70| 65 66 75 6c 20 74 68 69 | 6e 67 73 20 77 65 20 63 |eful thi|ngs we c|
|00000d80| 61 6e 20 6c 65 61 72 6e | 20 66 72 6f 6d 20 70 72 |an learn| from pr|
|00000d90| 6f 67 72 61 6d 6d 69 6e | 67 20 69 73 20 74 68 65 |ogrammin|g is the|
|00000da0| 20 70 6f 73 73 69 62 69 | 6c 69 74 79 0a 6f 66 20 | possibi|lity.of |
|00000db0| 7b 5c 65 6d 20 64 65 62 | 75 67 67 69 6e 67 7d 20 |{\em deb|ugging} |
|00000dc0| 74 6f 20 63 6f 72 72 65 | 63 74 20 6f 75 72 20 6d |to corre|ct our m|
|00000dd0| 69 73 74 61 6b 65 73 2e | 7d 20 54 68 69 73 20 69 |istakes.|} This i|
|00000de0| 73 20 75 6e 66 6f 72 74 | 75 6e 61 74 65 2c 0a 62 |s unfort|unate,.b|
|00000df0| 65 63 61 75 73 65 20 69 | 74 20 64 65 73 74 72 6f |ecause i|t destro|
|00000e00| 79 73 20 69 6e 66 6f 72 | 6d 61 74 69 6f 6e 20 61 |ys infor|mation a|
|00000e10| 62 6f 75 74 20 74 68 65 | 20 65 72 72 6f 72 20 74 |bout the| error t|
|00000e20| 68 61 74 20 63 61 6e 20 | 62 65 20 75 73 65 64 20 |hat can |be used |
|00000e30| 74 6f 0a 61 69 64 20 69 | 6e 20 64 65 62 75 67 67 |to.aid i|n debugg|
|00000e40| 69 6e 67 2e 20 20 57 68 | 65 6e 20 79 6f 75 20 65 |ing. Wh|en you e|
|00000e50| 6e 63 6f 75 6e 74 65 72 | 20 61 6e 20 65 72 72 6f |ncounter| an erro|
|00000e60| 72 2c 20 74 61 6b 65 20 | 73 6f 6d 65 20 74 69 6d |r, take |some tim|
|00000e70| 65 20 74 6f 20 7b 5c 65 | 6d 0a 74 68 69 6e 6b 7d |e to {\e|m.think}|
|00000e80| 20 61 62 6f 75 74 20 74 | 68 65 20 65 72 72 6f 72 | about t|he error|
|00000e90| 2c 20 72 61 74 68 65 72 | 20 74 68 61 6e 20 69 6d |, rather| than im|
|00000ea0| 6d 65 64 69 61 74 65 6c | 79 20 61 62 6f 72 74 69 |mediatel|y aborti|
|00000eb0| 6e 67 20 61 73 20 61 0a | 60 60 6b 6e 65 65 2d 6a |ng as a.|``knee-j|
|00000ec0| 65 72 6b 27 27 20 72 65 | 61 63 74 69 6f 6e 2e 0a |erk'' re|action..|
|00000ed0| 0a 53 63 68 65 6d 65 20 | 70 72 6f 76 69 64 65 73 |.Scheme |provides|
|00000ee0| 20 73 79 73 74 65 6d 20 | 66 65 61 74 75 72 65 73 | system |features|
|00000ef0| 20 74 68 61 74 20 6d 61 | 6b 65 20 75 73 65 20 6f | that ma|ke use o|
|00000f00| 66 20 74 68 65 20 65 72 | 72 6f 72 20 65 6e 76 69 |f the er|ror envi|
|00000f10| 72 6f 6e 6d 65 6e 74 0a | 69 6e 20 6f 72 64 65 72 |ronment.|in order|
|00000f20| 20 74 6f 20 68 65 6c 70 | 20 79 6f 75 20 74 6f 20 | to help| you to |
|00000f30| 74 72 79 20 61 6e 64 20 | 6c 6f 63 61 74 65 20 77 |try and |locate w|
|00000f40| 68 65 72 65 20 74 68 65 | 20 65 72 72 6f 72 20 6f |here the| error o|
|00000f50| 63 63 75 72 72 65 64 2e | 20 20 54 68 61 74 0a 69 |ccurred.| That.i|
|00000f60| 73 2c 20 79 6f 75 20 63 | 61 6e 20 73 65 65 20 77 |s, you c|an see w|
|00000f70| 68 61 74 20 65 78 70 72 | 65 73 73 69 6f 6e 73 20 |hat expr|essions |
|00000f80| 77 65 72 65 20 62 65 69 | 6e 67 20 65 78 65 63 75 |were bei|ng execu|
|00000f90| 74 65 64 20 61 74 20 74 | 68 65 20 74 69 6d 65 20 |ted at t|he time |
|00000fa0| 6f 66 0a 74 68 65 20 65 | 72 72 6f 72 2e 20 20 54 |of.the e|rror. T|
|00000fb0| 68 65 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 20 61 |he envir|onment a|
|00000fc0| 6e 64 20 68 69 73 74 6f | 72 79 20 65 78 61 6d 69 |nd histo|ry exami|
|00000fd0| 6e 65 72 73 2c 20 5c 69 | 64 65 7b 77 68 65 72 65 |ners, \i|de{where|
|00000fe0| 7d 0a 61 6e 64 20 5c 69 | 64 65 7b 64 65 62 75 67 |}.and \i|de{debug|
|00000ff0| 7d 2c 20 72 65 73 70 65 | 63 74 69 76 65 6c 79 2c |}, respe|ctively,|
|00001000| 20 61 72 65 20 75 73 65 | 64 20 66 6f 72 20 74 68 | are use|d for th|
|00001010| 69 73 2e 20 20 4f 66 20 | 63 6f 75 72 73 65 2c 20 |is. Of |course, |
|00001020| 6d 75 63 68 20 63 61 6e | 0a 62 65 20 64 65 74 65 |much can|.be dete|
|00001030| 72 6d 69 6e 65 64 20 61 | 62 6f 75 74 20 74 68 65 |rmined a|bout the|
|00001040| 20 73 74 61 74 65 20 6f | 66 20 74 68 65 20 73 79 | state o|f the sy|
|00001050| 73 74 65 6d 20 61 74 20 | 74 68 65 20 74 69 6d 65 |stem at |the time|
|00001060| 20 6f 66 20 74 68 65 20 | 65 72 72 6f 72 0a 62 79 | of the |error.by|
|00001070| 20 73 69 6d 70 6c 79 20 | 65 78 61 6d 69 6e 69 6e | simply |examinin|
|00001080| 67 20 74 68 65 20 76 61 | 6c 75 65 73 20 6f 66 20 |g the va|lues of |
|00001090| 76 61 72 69 61 62 6c 65 | 73 20 69 6e 20 74 68 65 |variable|s in the|
|000010a0| 20 65 72 72 6f 72 20 65 | 6e 76 69 72 6f 6e 6d 65 | error e|nvironme|
|000010b0| 6e 74 2e 0a 0a 54 68 65 | 20 70 72 6f 67 72 61 6d |nt...The| program|
|000010c0| 20 6d 61 79 20 72 75 6e | 20 77 69 74 68 6f 75 74 | may run| without|
|000010d0| 20 65 72 72 6f 72 2c 20 | 62 75 74 20 74 68 65 20 | error, |but the |
|000010e0| 72 65 73 75 6c 74 20 70 | 72 6f 64 75 63 65 64 20 |result p|roduced |
|000010f0| 6d 61 79 0a 62 65 20 70 | 72 65 70 6f 73 74 65 72 |may.be p|reposter|
|00001100| 6f 75 73 2d 2d 2d 61 6e | 6f 74 68 65 72 20 69 6e |ous---an|other in|
|00001110| 64 69 63 61 74 69 6f 6e | 20 6f 66 20 62 75 67 73 |dication| of bugs|
|00001120| 2e 20 20 46 6f 72 20 69 | 6e 73 74 61 6e 63 65 2c |. For i|nstance,|
|00001130| 0a 5c 62 65 67 69 6e 7b | 73 63 68 65 6d 65 7d 0a |.\begin{|scheme}.|
|00001140| 28 70 72 69 6d 65 3f 20 | 37 29 20 20 20 20 20 5c |(prime? |7) \|
|00001150| 65 76 20 20 5c 73 63 68 | 66 61 6c 73 65 0a 5c 65 |ev \sch|false.\e|
|00001160| 6e 64 7b 73 63 68 65 6d | 65 7d 0a 5c 6e 6f 69 6e |nd{schem|e}.\noin|
|00001170| 64 65 6e 74 0a 49 6e 20 | 74 68 69 73 20 73 69 74 |dent.In |this sit|
|00001180| 75 61 74 69 6f 6e 2c 20 | 53 63 68 65 6d 65 20 6f |uation, |Scheme o|
|00001190| 66 66 65 72 73 20 6e 6f | 20 63 6c 75 65 20 61 73 |ffers no| clue as|
|000011a0| 20 74 6f 20 74 68 65 20 | 6c 6f 63 61 74 69 6f 6e | to the |location|
|000011b0| 20 6f 66 20 74 68 65 0a | 62 75 67 2d 2d 2d 79 6f | of the.|bug---yo|
|000011c0| 75 27 72 65 20 6f 6e 20 | 79 6f 75 72 20 6f 77 6e |u're on |your own|
|000011d0| 2e 20 20 59 6f 75 20 6d | 69 67 68 74 20 70 72 6f |. You m|ight pro|
|000011e0| 64 75 63 65 20 61 20 74 | 68 65 6f 72 79 20 61 62 |duce a t|heory ab|
|000011f0| 6f 75 74 20 74 68 65 20 | 63 61 75 73 65 0a 6f 66 |out the |cause.of|
|00001200| 20 74 68 65 20 64 65 76 | 69 61 6e 74 20 62 65 68 | the dev|iant beh|
|00001210| 61 76 69 6f 72 20 61 6e | 64 20 74 68 65 6e 20 74 |avior an|d then t|
|00001220| 65 73 74 20 69 74 20 75 | 73 69 6e 67 20 74 68 65 |est it u|sing the|
|00001230| 20 7b 5c 74 74 20 74 72 | 61 63 65 7d 0a 66 61 63 | {\tt tr|ace}.fac|
|00001240| 69 6c 69 74 79 2e 20 20 | 59 6f 75 20 63 61 6e 20 |ility. |You can |
|00001250| 61 6c 73 6f 20 65 64 69 | 74 20 74 68 65 20 70 72 |also edi|t the pr|
|00001260| 6f 67 72 61 6d 20 74 6f | 20 69 6e 73 65 72 74 20 |ogram to| insert |
|00001270| 63 68 65 63 6b 73 20 61 | 6e 64 20 74 72 61 63 65 |checks a|nd trace|
|00001280| 73 2e 0a 0a 44 65 62 75 | 67 67 69 6e 67 2c 20 6c |s...Debu|gging, l|
|00001290| 69 6b 65 20 70 72 6f 67 | 72 61 6d 6d 69 6e 67 2c |ike prog|ramming,|
|000012a0| 20 69 73 20 61 6e 20 61 | 63 71 75 69 72 65 64 20 | is an a|cquired |
|000012b0| 73 6b 69 6c 6c 20 61 6e | 64 20 61 6e 20 61 72 74 |skill an|d an art|
|000012c0| 2e 0a 54 68 65 20 74 6f | 6f 6c 73 20 61 76 61 69 |..The to|ols avai|
|000012d0| 6c 61 62 6c 65 20 74 6f | 20 79 6f 75 20 61 72 65 |lable to| you are|
|000012e0| 20 64 65 73 63 72 69 62 | 65 64 20 69 6e 20 74 68 | describ|ed in th|
|000012f0| 65 20 73 65 63 74 69 6f | 6e 73 20 62 65 6c 6f 77 |e sectio|ns below|
|00001300| 2e 20 20 55 73 65 0a 74 | 68 65 6d 20 63 72 65 61 |. Use.t|hem crea|
|00001310| 74 69 76 65 6c 79 2e 20 | 20 54 68 65 20 6c 61 62 |tively. | The lab|
|00001320| 6f 72 61 74 6f 72 79 20 | 61 73 73 69 73 74 61 6e |oratory |assistan|
|00001330| 74 73 0a 61 72 65 20 74 | 68 65 72 65 20 74 6f 20 |ts.are t|here to |
|00001340| 68 65 6c 70 20 79 6f 75 | 2e 20 20 46 65 65 6c 20 |help you|. Feel |
|00001350| 66 72 65 65 20 74 6f 20 | 61 73 6b 20 74 68 65 6d |free to |ask them|
|00001360| 20 66 6f 72 20 68 65 6c | 70 2e 0a 0a 5c 73 65 63 | for hel|p...\sec|
|00001370| 74 69 6f 6e 7b 52 65 61 | 64 2d 45 76 61 6c 2d 50 |tion{Rea|d-Eval-P|
|00001380| 72 69 6e 74 20 4c 65 76 | 65 6c 73 7d 0a 5c 6c 61 |rint Lev|els}.\la|
|00001390| 62 65 6c 7b 72 65 70 2d | 6c 6f 6f 70 73 7d 0a 0a |bel{rep-|loops}..|
|000013a0| 54 68 65 20 53 63 68 65 | 6d 65 20 69 6e 74 65 72 |The Sche|me inter|
|000013b0| 70 72 65 74 65 72 20 77 | 6f 72 6b 73 20 62 79 20 |preter w|orks by |
|000013c0| 72 75 6e 6e 69 6e 67 20 | 61 20 5c 64 65 66 69 6e |running |a \defin|
|000013d0| 69 6e 67 7b 72 65 61 64 | 2d 65 76 61 6c 2d 70 72 |ing{read|-eval-pr|
|000013e0| 69 6e 74 7d 20 6c 6f 6f | 70 20 28 6f 72 0a 52 45 |int} loo|p (or.RE|
|000013f0| 50 20 6c 6f 6f 70 29 2e | 20 20 54 68 69 73 20 6d |P loop).| This m|
|00001400| 65 61 6e 73 20 74 68 61 | 74 0a 65 78 70 72 65 73 |eans tha|t.expres|
|00001410| 73 69 6f 6e 73 20 61 72 | 65 20 72 65 61 64 2c 20 |sions ar|e read, |
|00001420| 65 76 61 6c 75 61 74 65 | 64 2c 20 61 6e 64 20 74 |evaluate|d, and t|
|00001430| 68 65 20 72 65 73 75 6c | 74 20 6f 66 20 74 68 65 |he resul|t of the|
|00001440| 20 65 76 61 6c 75 61 74 | 69 6f 6e 20 69 73 0a 70 | evaluat|ion is.p|
|00001450| 72 69 6e 74 65 64 20 6f | 6e 20 74 68 65 20 63 6f |rinted o|n the co|
|00001460| 6e 73 6f 6c 65 2e 20 20 | 41 20 52 45 50 20 6c 6f |nsole. |A REP lo|
|00001470| 6f 70 20 63 61 6e 20 62 | 65 20 6e 65 73 74 65 64 |op can b|e nested|
|00001480| 20 69 6e 73 69 64 65 20 | 61 6e 6f 74 68 65 72 20 | inside |another |
|00001490| 52 45 50 0a 6c 6f 6f 70 | 2e 20 20 54 68 69 73 20 |REP.loop|. This |
|000014a0| 69 73 20 77 68 61 74 20 | 68 61 70 70 65 6e 73 20 |is what |happens |
|000014b0| 61 74 20 61 20 62 72 65 | 61 6b 70 6f 69 6e 74 20 |at a bre|akpoint |
|000014c0| 6f 72 20 61 6e 20 65 72 | 72 6f 72 2e 20 20 54 68 |or an er|ror. Th|
|000014d0| 65 20 6d 6f 64 65 0a 6c | 69 6e 65 20 69 6e 64 69 |e mode.l|ine indi|
|000014e0| 63 61 74 6f 72 0a 69 73 | 20 63 68 61 6e 67 65 64 |cator.is| changed|
|000014f0| 20 74 6f 20 7b 5c 74 74 | 20 42 72 65 61 6b 7d 20 | to {\tt| Break} |
|00001500| 6f 72 20 7b 5c 74 74 20 | 45 72 72 6f 72 7d 20 74 |or {\tt |Error} t|
|00001510| 6f 20 73 69 67 6e 69 66 | 79 20 74 68 61 74 20 61 |o signif|y that a|
|00001520| 6e 6f 74 68 65 72 20 6e | 65 73 74 65 64 0a 52 45 |nother n|ested.RE|
|00001530| 50 20 6c 6f 6f 70 20 68 | 61 73 20 62 65 65 6e 20 |P loop h|as been |
|00001540| 65 6e 74 65 72 65 64 2e | 20 20 54 68 65 20 45 6d |entered.| The Em|
|00001550| 61 63 73 20 63 6f 6d 6d | 61 6e 64 73 20 5c 63 74 |acs comm|ands \ct|
|00001560| 6c 63 7b 47 7d 2c 0a 5c | 63 74 6c 63 7b 55 7d 2c |lc{G},.\|ctlc{U},|
|00001570| 20 61 6e 64 20 5c 63 74 | 6c 63 7b 58 7d 0a 61 6c | and \ct|lc{X}.al|
|00001580| 6c 20 61 66 66 65 63 74 | 20 74 68 65 20 52 45 50 |l affect| the REP|
|00001590| 20 6c 65 76 65 6c 20 79 | 6f 75 20 61 72 65 20 61 | level y|ou are a|
|000015a0| 74 2e 0a 54 68 65 20 7b | 5c 74 74 20 4c 65 76 65 |t..The {|\tt Leve|
|000015b0| 6c 7d 20 69 73 20 74 68 | 65 20 64 65 67 72 65 65 |l} is th|e degree|
|000015c0| 20 6f 66 20 6e 65 73 74 | 69 6e 67 20 6f 66 20 52 | of nest|ing of R|
|000015d0| 45 50 20 6c 6f 6f 70 73 | 2c 20 77 68 65 72 65 20 |EP loops|, where |
|000015e0| 6c 65 76 65 6c 20 31 20 | 69 73 0a 74 68 65 20 74 |level 1 |is.the t|
|000015f0| 6f 70 6d 6f 73 74 20 52 | 45 50 20 6c 6f 6f 70 2e |opmost R|EP loop.|
|00001600| 20 20 42 65 6c 6f 77 20 | 61 72 65 20 6c 69 73 74 | Below |are list|
|00001610| 65 64 20 73 6f 6d 65 20 | 63 6f 6e 74 72 6f 6c 20 |ed some |control |
|00001620| 63 68 61 72 61 63 74 65 | 72 73 20 75 73 65 64 0a |characte|rs used.|
|00001630| 74 6f 20 69 6e 74 65 72 | 72 75 70 74 20 70 72 6f |to inter|rupt pro|
|00001640| 67 72 61 6d 73 20 6f 6e | 20 76 61 72 69 6f 75 73 |grams on| various|
|00001650| 20 6c 65 76 65 6c 73 2c | 20 61 6c 73 6f 20 6c 69 | levels,| also li|
|00001660| 73 74 65 64 20 61 72 65 | 20 6f 74 68 65 72 20 75 |sted are| other u|
|00001670| 73 65 66 75 6c 0a 63 6f | 6e 74 72 6f 6c 20 63 68 |seful.co|ntrol ch|
|00001680| 61 72 61 63 74 65 72 73 | 2e 0a 0a 5c 62 65 67 69 |aracters|...\begi|
|00001690| 6e 7b 64 65 73 63 72 69 | 70 74 69 6f 6e 7d 0a 5c |n{descri|ption}.\|
|000016a0| 69 74 65 6d 20 5b 5c 63 | 74 6c 63 7b 42 7d 5d 20 |item [\c|tlc{B}] |
|000016b0| 45 6e 74 65 72 73 20 61 | 20 42 72 65 61 6b 70 6f |Enters a| Breakpo|
|000016c0| 69 6e 74 2e 20 20 54 68 | 65 20 6e 65 77 20 6c 65 |int. Th|e new le|
|000016d0| 76 65 6c 20 77 69 6c 6c | 20 62 65 20 6f 6e 65 20 |vel will| be one |
|000016e0| 68 69 67 68 65 72 0a 74 | 68 61 6e 20 69 74 20 77 |higher.t|han it w|
|000016f0| 61 73 20 62 65 66 6f 72 | 65 20 74 68 65 20 62 72 |as befor|e the br|
|00001700| 65 61 6b 70 6f 69 6e 74 | 2e 0a 0a 5c 69 74 65 6d |eakpoint|...\item|
|00001710| 20 5b 5c 63 74 6c 63 7b | 47 7d 5d 20 48 61 6c 74 | [\ctlc{|G}] Halt|
|00001720| 73 20 65 78 65 63 75 74 | 69 6f 6e 20 61 74 20 61 |s execut|ion at a|
|00001730| 6c 6c 20 6c 65 76 65 6c | 73 2e 20 52 65 74 75 72 |ll level|s. Retur|
|00001740| 6e 73 20 74 6f 20 74 68 | 65 20 74 6f 70 20 6c 65 |ns to th|e top le|
|00001750| 76 65 6c 0a 28 6c 65 76 | 65 6c 20 31 29 20 52 45 |vel.(lev|el 1) RE|
|00001760| 50 20 6c 6f 6f 70 2e 0a | 0a 5c 69 74 65 6d 20 5b |P loop..|.\item [|
|00001770| 5c 63 74 6c 63 7b 55 7d | 5d 20 48 61 6c 74 73 20 |\ctlc{U}|] Halts |
|00001780| 65 78 65 63 75 74 69 6f | 6e 20 6c 6f 63 61 6c 6c |executio|n locall|
|00001790| 79 2e 20 20 52 65 74 75 | 72 6e 73 20 74 6f 20 74 |y. Retu|rns to t|
|000017a0| 68 65 20 70 72 65 76 69 | 6f 75 73 20 52 45 50 0a |he previ|ous REP.|
|000017b0| 6c 6f 6f 70 2c 20 75 6e | 6c 65 73 73 20 61 6c 72 |loop, un|less alr|
|000017c0| 65 61 64 79 20 61 74 20 | 74 68 65 20 74 6f 70 20 |eady at |the top |
|000017d0| 6c 65 76 65 6c 20 6c 6f | 6f 70 2e 20 20 54 68 61 |level lo|op. Tha|
|000017e0| 74 20 69 73 2c 0a 74 68 | 65 20 6e 65 77 20 6c 65 |t is,.th|e new le|
|000017f0| 76 65 6c 20 69 73 20 6f | 6e 65 20 6c 65 73 73 20 |vel is o|ne less |
|00001800| 74 68 61 6e 20 69 74 20 | 75 73 65 64 20 74 6f 20 |than it |used to |
|00001810| 62 65 2c 20 75 6e 6c 65 | 73 73 20 79 6f 75 0a 77 |be, unle|ss you.w|
|00001820| 65 72 65 20 61 6c 72 65 | 61 64 79 20 61 74 20 6c |ere alre|ady at l|
|00001830| 65 76 65 6c 20 31 2e 0a | 0a 5c 69 74 65 6d 20 5b |evel 1..|.\item [|
|00001840| 5c 63 74 6c 63 7b 58 7d | 5d 20 48 61 6c 74 73 20 |\ctlc{X}|] Halts |
|00001850| 65 78 65 63 75 74 69 6f | 6e 20 6c 6f 63 61 6c 6c |executio|n locall|
|00001860| 79 2e 20 20 52 65 74 75 | 72 6e 73 20 74 6f 20 74 |y. Retu|rns to t|
|00001870| 68 65 20 63 75 72 72 65 | 6e 74 20 52 45 50 0a 6c |he curre|nt REP.l|
|00001880| 6f 6f 70 2e 20 20 54 68 | 65 20 6c 65 76 65 6c 20 |oop. Th|e level |
|00001890| 6e 75 6d 62 65 72 20 72 | 65 6d 61 69 6e 73 20 75 |number r|emains u|
|000018a0| 6e 63 68 61 6e 67 65 64 | 2e 0a 5c 65 6e 64 7b 64 |nchanged|..\end{d|
|000018b0| 65 73 63 72 69 70 74 69 | 6f 6e 7d 0a 0a 4f 6e 63 |escripti|on}..Onc|
|000018c0| 65 20 61 67 61 69 6e 2c | 20 74 68 65 20 64 69 66 |e again,| the dif|
|000018d0| 66 65 72 65 6e 74 20 6d | 6f 64 65 20 6c 69 6e 65 |ferent m|ode line|
|000018e0| 20 69 6e 64 69 63 61 74 | 6f 72 73 20 61 72 65 3a | indicat|ors are:|
|000018f0| 20 7b 5c 74 74 20 52 45 | 50 7d 2c 0a 6f 72 64 69 | {\tt RE|P},.ordi|
|00001900| 6e 61 72 79 20 72 65 61 | 64 2d 65 76 61 6c 2d 70 |nary rea|d-eval-p|
|00001910| 72 69 6e 74 20 6c 6f 6f | 70 3b 20 7b 5c 74 74 20 |rint loo|p; {\tt |
|00001920| 42 72 65 61 6b 7d 2c 20 | 61 20 62 72 65 61 6b 70 |Break}, |a breakp|
|00001930| 6f 69 6e 74 20 52 45 50 | 20 6c 6f 6f 70 3b 20 61 |oint REP| loop; a|
|00001940| 6e 64 20 7b 5c 74 74 0a | 45 72 72 6f 72 7d 20 61 |nd {\tt.|Error} a|
|00001950| 6e 20 65 72 72 6f 72 20 | 52 45 50 20 6c 6f 6f 70 |n error |REP loop|
|00001960| 2e 0a 0a 5c 73 65 63 74 | 69 6f 6e 7b 42 72 65 61 |...\sect|ion{Brea|
|00001970| 6b 70 6f 69 6e 74 20 61 | 6e 64 20 45 72 72 6f 72 |kpoint a|nd Error|
|00001980| 20 52 45 50 20 4c 6f 6f | 70 73 7d 0a 5c 6c 61 62 | REP Loo|ps}.\lab|
|00001990| 65 6c 7b 65 72 72 6f 72 | 72 65 70 7d 0a 0a 41 73 |el{error|rep}..As|
|000019a0| 20 6d 65 6e 74 69 6f 6e | 65 64 20 61 62 6f 76 65 | mention|ed above|
|000019b0| 2c 20 79 6f 75 20 63 61 | 6e 20 63 68 6f 6f 73 65 |, you ca|n choose|
|000019c0| 20 74 6f 20 65 6e 74 65 | 72 20 61 6e 20 65 72 72 | to ente|r an err|
|000019d0| 6f 72 20 52 45 50 20 6c | 6f 6f 70 0a 77 68 65 6e |or REP l|oop.when|
|000019e0| 65 76 65 72 20 61 6e 20 | 65 72 72 6f 72 20 69 73 |ever an |error is|
|000019f0| 20 73 69 67 6e 61 6c 6c | 65 64 2e 20 20 54 68 69 | signall|ed. Thi|
|00001a00| 73 20 65 72 72 6f 72 20 | 6d 61 79 20 68 61 76 65 |s error |may have|
|00001a10| 20 62 65 65 6e 20 73 69 | 67 6e 61 6c 6c 65 64 0a | been si|gnalled.|
|00001a20| 69 6e 74 65 72 6e 61 6c | 6c 79 20 62 79 20 53 63 |internal|ly by Sc|
|00001a30| 68 65 6d 65 2c 20 6f 72 | 20 69 74 20 6d 61 79 20 |heme, or| it may |
|00001a40| 68 61 76 65 20 62 65 65 | 6e 20 73 69 67 6e 61 6c |have bee|n signal|
|00001a50| 6c 65 64 20 62 79 20 61 | 6e 20 5c 69 64 65 7b 65 |led by a|n \ide{e|
|00001a60| 72 72 6f 72 7d 0a 73 74 | 61 74 65 6d 65 6e 74 20 |rror}.st|atement |
|00001a70| 74 68 61 74 20 79 6f 75 | 20 69 6e 73 65 72 74 65 |that you| inserte|
|00001a80| 64 20 69 6e 20 74 68 65 | 20 70 72 6f 67 72 61 6d |d in the| program|
|00001a90| 20 79 6f 75 72 73 65 6c | 66 2e 20 20 4c 6f 6f 70 | yoursel|f. Loop|
|00001aa0| 73 20 6f 66 20 61 0a 73 | 6c 69 67 68 74 6c 79 20 |s of a.s|lightly |
|00001ab0| 64 69 66 66 65 72 65 6e | 74 20 66 6c 61 76 6f 72 |differen|t flavor|
|00001ac0| 20 63 61 6e 20 62 65 20 | 65 6e 74 65 72 65 64 20 | can be |entered |
|00001ad0| 76 69 61 20 74 68 65 20 | 5c 69 64 65 7b 62 6b 70 |via the |\ide{bkp|
|00001ae0| 74 7d 20 73 70 65 63 69 | 61 6c 20 66 6f 72 6d 20 |t} speci|al form |
|00001af0| 6f 72 0a 62 79 20 74 79 | 70 69 6e 67 20 61 20 5c |or.by ty|ping a \|
|00001b00| 63 74 6c 63 7b 42 7d 20 | 61 74 20 74 68 65 20 6b |ctlc{B} |at the k|
|00001b10| 65 79 62 6f 61 72 64 2e | 0a 0a 54 68 65 20 53 63 |eyboard.|..The Sc|
|00001b20| 68 65 6d 65 20 62 72 65 | 61 6b 70 6f 69 6e 74 20 |heme bre|akpoint |
|00001b30| 66 61 63 69 6c 69 74 79 | 20 61 6c 6c 6f 77 73 20 |facility| allows |
|00001b40| 79 6f 75 20 74 6f 20 70 | 61 75 73 65 20 65 78 65 |you to p|ause exe|
|00001b50| 63 75 74 69 6f 6e 0a 6f | 66 20 61 20 70 72 6f 67 |cution.o|f a prog|
|00001b60| 72 61 6d 20 69 6e 20 6d | 69 64 73 74 72 65 61 6d |ram in m|idstream|
|00001b70| 2c 20 77 68 65 72 65 75 | 70 6f 6e 20 79 6f 75 20 |, whereu|pon you |
|00001b80| 63 61 6e 20 65 78 61 6d | 69 6e 65 20 61 6e 64 20 |can exam|ine and |
|00001b90| 6d 6f 64 69 66 79 0a 74 | 68 65 20 76 61 6c 75 65 |modify.t|he value|
|00001ba0| 73 20 6f 66 20 6c 6f 63 | 61 6c 20 76 61 72 69 61 |s of loc|al varia|
|00001bb0| 62 6c 65 73 2c 20 61 6d | 6f 6e 67 20 6f 74 68 65 |bles, am|ong othe|
|00001bc0| 72 20 74 68 69 6e 67 73 | 2e 20 20 57 68 65 6e 20 |r things|. When |
|00001bd0| 79 6f 75 20 70 61 75 73 | 65 0a 65 78 65 63 75 74 |you paus|e.execut|
|00001be0| 69 6f 6e 20 61 6e 64 20 | 65 6e 74 65 72 20 61 20 |ion and |enter a |
|00001bf0| 62 72 65 61 6b 70 6f 69 | 6e 74 2c 20 53 63 68 65 |breakpoi|nt, Sche|
|00001c00| 6d 65 20 72 75 6e 73 20 | 61 20 52 45 50 20 6c 6f |me runs |a REP lo|
|00001c10| 6f 70 20 6a 75 73 74 20 | 61 73 20 69 74 0a 6e 6f |op just |as it.no|
|00001c20| 72 6d 61 6c 6c 79 20 64 | 6f 65 73 2d 2d 2d 79 6f |rmally d|oes---yo|
|00001c30| 75 20 74 79 70 65 20 65 | 78 70 72 65 73 73 69 6f |u type e|xpressio|
|00001c40| 6e 73 20 61 6e 64 20 74 | 68 65 20 69 6e 74 65 72 |ns and t|he inter|
|00001c50| 70 72 65 74 65 72 20 65 | 76 61 6c 75 61 74 65 73 |preter e|valuates|
|00001c60| 0a 74 68 65 6d 20 61 6e | 64 20 70 72 69 6e 74 73 |.them an|d prints|
|00001c70| 20 74 68 65 69 72 20 76 | 61 6c 75 65 2e 20 20 54 | their v|alue. T|
|00001c80| 68 65 20 64 69 66 66 65 | 72 65 6e 63 65 20 69 73 |he diffe|rence is|
|00001c90| 20 74 68 61 74 20 74 68 | 65 20 65 6e 76 69 72 6f | that th|e enviro|
|00001ca0| 6e 6d 65 6e 74 0a 69 6e | 20 77 68 69 63 68 20 74 |nment.in| which t|
|00001cb0| 68 65 73 65 20 65 78 70 | 72 65 73 73 69 6f 6e 73 |hese exp|ressions|
|00001cc0| 20 61 72 65 20 65 76 61 | 6c 75 61 74 65 64 20 69 | are eva|luated i|
|00001cd0| 73 20 6e 6f 74 20 74 68 | 65 20 67 6c 6f 62 61 6c |s not th|e global|
|00001ce0| 0a 65 6e 76 69 72 6f 6e | 6d 65 6e 74 2c 20 62 75 |.environ|ment, bu|
|00001cf0| 74 20 72 61 74 68 65 72 | 20 74 68 65 20 65 6e 76 |t rather| the env|
|00001d00| 69 72 6f 6e 6d 65 6e 74 | 20 66 72 6f 6d 20 77 68 |ironment| from wh|
|00001d10| 69 63 68 20 74 68 65 20 | 62 72 65 61 6b 70 6f 69 |ich the |breakpoi|
|00001d20| 6e 74 20 77 61 73 0a 65 | 6e 74 65 72 65 64 2e 0a |nt was.e|ntered..|
|00001d30| 0a 42 72 65 61 6b 70 6f | 69 6e 74 73 20 63 61 6e |.Breakpo|ints can|
|00001d40| 20 62 65 20 65 6e 74 65 | 72 65 64 20 69 6e 20 74 | be ente|red in t|
|00001d50| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 77 61 79 |he follo|wing way|
|00001d60| 73 3a 0a 0a 5c 62 65 67 | 69 6e 7b 69 74 65 6d 69 |s:..\beg|in{itemi|
|00001d70| 7a 65 7d 0a 5c 69 74 65 | 6d 20 54 79 70 69 6e 67 |ze}.\ite|m Typing|
|00001d80| 20 5c 63 74 6c 63 7b 42 | 7d 20 61 74 20 74 68 65 | \ctlc{B|} at the|
|00001d90| 20 6b 65 79 62 6f 61 72 | 64 2e 20 20 54 68 69 73 | keyboar|d. This|
|00001da0| 20 77 69 6c 6c 20 61 6c | 77 61 79 73 20 6c 65 61 | will al|ways lea|
|00001db0| 76 65 20 79 6f 75 20 69 | 6e 20 74 68 65 0a 65 6e |ve you i|n the.en|
|00001dc0| 76 69 72 6f 6e 6d 65 6e | 74 20 6f 66 20 74 68 65 |vironmen|t of the|
|00001dd0| 20 70 72 65 76 69 6f 75 | 73 20 28 6c 6f 77 65 72 | previou|s (lower|
|00001de0| 20 6c 65 76 65 6c 20 6e | 75 6d 62 65 72 29 20 52 | level n|umber) R|
|00001df0| 45 50 20 6c 6f 6f 70 2e | 0a 0a 5c 69 74 65 6d 20 |EP loop.|..\item |
|00001e00| 45 78 65 63 75 74 69 6e | 67 20 61 20 70 72 6f 63 |Executin|g a proc|
|00001e10| 65 64 75 72 65 20 74 68 | 61 74 20 68 61 64 20 61 |edure th|at had a|
|00001e20| 20 62 72 65 61 6b 70 6f | 69 6e 74 20 69 6e 73 74 | breakpo|int inst|
|00001e30| 61 6c 6c 65 64 20 76 69 | 61 20 6f 6e 65 20 6f 66 |alled vi|a one of|
|00001e40| 20 74 68 65 0a 63 6f 6d | 6d 61 6e 64 73 20 5c 69 | the.com|mands \i|
|00001e50| 64 65 7b 62 72 65 61 6b | 7d 2c 20 5c 69 64 65 7b |de{break|}, \ide{|
|00001e60| 62 72 65 61 6b 2d 65 6e | 74 72 79 7d 2c 20 5c 69 |break-en|try}, \i|
|00001e70| 64 65 7b 62 72 65 61 6b | 2d 65 78 69 74 7d 2c 20 |de{break|-exit}, |
|00001e80| 6f 72 0a 5c 69 64 65 7b | 62 72 65 61 6b 2d 62 6f |or.\ide{|break-bo|
|00001e90| 74 68 7d 2e 20 20 54 68 | 69 73 20 77 69 6c 6c 20 |th}. Th|is will |
|00001ea0| 6c 65 61 76 65 20 79 6f | 75 20 69 6e 20 74 68 65 |leave yo|u in the|
|00001eb0| 20 65 6e 76 69 72 6f 6e | 6d 65 6e 74 20 63 72 65 | environ|ment cre|
|00001ec0| 61 74 65 64 20 74 6f 0a | 65 76 61 6c 75 61 74 65 |ated to.|evaluate|
|00001ed0| 20 74 68 65 20 62 6f 64 | 79 20 6f 66 20 74 68 65 | the bod|y of the|
|00001ee0| 20 60 60 62 72 6f 6b 65 | 6e 27 27 20 70 72 6f 63 | ``broke|n'' proc|
|00001ef0| 65 64 75 72 65 2e 0a 0a | 5c 69 74 65 6d 20 45 78 |edure...|\item Ex|
|00001f00| 65 63 75 74 69 6e 67 20 | 74 68 65 20 70 72 6f 63 |ecuting |the proc|
|00001f10| 65 64 75 72 65 20 5c 69 | 64 65 7b 62 6b 70 74 7d |edure \i|de{bkpt}|
|00001f20| 2e 20 20 54 68 69 73 20 | 77 69 6c 6c 20 6c 65 61 |. This |will lea|
|00001f30| 76 65 20 79 6f 75 20 69 | 6e 20 74 68 65 0a 65 6e |ve you i|n the.en|
|00001f40| 76 69 72 6f 6e 6d 65 6e | 74 20 69 6e 20 77 68 69 |vironmen|t in whi|
|00001f50| 63 68 20 74 68 65 20 7b | 5c 74 74 20 62 6b 70 74 |ch the {|\tt bkpt|
|00001f60| 7d 20 69 73 20 65 76 61 | 6c 75 61 74 65 64 2e 0a |} is eva|luated..|
|00001f70| 0a 5c 69 74 65 6d 20 45 | 6e 63 6f 75 6e 74 65 72 |.\item E|ncounter|
|00001f80| 69 6e 67 20 61 6e 20 65 | 72 72 6f 72 2e 20 20 59 |ing an e|rror. Y|
|00001f90| 6f 75 20 61 72 65 20 6c | 65 66 74 20 69 6e 20 74 |ou are l|eft in t|
|00001fa0| 68 65 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 20 69 |he envir|onment i|
|00001fb0| 6e 20 77 68 69 63 68 20 | 74 68 65 0a 65 78 70 72 |n which |the.expr|
|00001fc0| 65 73 73 69 6f 6e 20 63 | 61 75 73 69 6e 67 20 74 |ession c|ausing t|
|00001fd0| 68 65 20 65 72 72 6f 72 | 20 77 61 73 20 65 76 61 |he error| was eva|
|00001fe0| 6c 75 61 74 65 64 2e 20 | 20 42 65 63 61 75 73 65 |luated. | Because|
|00001ff0| 20 74 68 65 20 53 63 68 | 65 6d 65 0a 69 6e 74 65 | the Sch|eme.inte|
|00002000| 72 70 72 65 74 65 72 20 | 69 73 20 6f 70 74 69 6d |rpreter |is optim|
|00002010| 69 7a 65 64 20 73 6f 20 | 74 68 61 74 20 69 74 20 |ized so |that it |
|00002020| 73 61 76 65 73 20 6f 6e | 6c 79 20 65 6e 76 69 72 |saves on|ly envir|
|00002030| 6f 6e 6d 65 6e 74 73 20 | 74 68 61 74 20 61 72 65 |onments |that are|
|00002040| 0a 6e 65 65 64 65 64 20 | 66 6f 72 20 73 75 62 73 |.needed |for subs|
|00002050| 65 71 75 65 6e 74 20 65 | 76 61 6c 75 61 74 69 6f |equent e|valuatio|
|00002060| 6e 73 2c 20 65 72 72 6f | 72 73 20 6d 61 79 20 6f |ns, erro|rs may o|
|00002070| 63 63 75 72 20 77 68 65 | 6e 20 74 68 65 72 65 20 |ccur whe|n there |
|00002080| 69 73 20 6e 6f 0a 65 6e | 76 69 72 6f 6e 6d 65 6e |is no.en|vironmen|
|00002090| 74 20 61 74 20 61 6c 6c | 2e 20 49 6e 20 74 68 69 |t at all|. In thi|
|000020a0| 73 20 63 61 73 65 20 61 | 20 77 61 72 6e 69 6e 67 |s case a| warning|
|000020b0| 20 69 73 20 70 72 69 6e | 74 65 64 20 61 6e 64 20 | is prin|ted and |
|000020c0| 79 6f 75 20 61 72 65 0a | 6c 65 66 74 20 69 6e 20 |you are.|left in |
|000020d0| 74 68 65 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 20 |the envi|ronment |
|000020e0| 6f 66 20 74 68 65 20 70 | 72 65 76 69 6f 75 73 20 |of the p|revious |
|000020f0| 28 6c 6f 77 65 72 20 6c | 65 76 65 6c 20 6e 75 6d |(lower l|evel num|
|00002100| 62 65 72 29 20 52 45 50 | 20 6c 6f 6f 70 2e 0a 5c |ber) REP| loop..\|
|00002110| 65 6e 64 7b 69 74 65 6d | 69 7a 65 7d 0a 0a 54 6f |end{item|ize}..To|
|00002120| 20 63 6f 6e 74 69 6e 75 | 65 20 66 72 6f 6d 20 61 | continu|e from a|
|00002130| 20 62 72 65 61 6b 70 6f | 69 6e 74 2c 20 65 76 61 | breakpo|int, eva|
|00002140| 6c 75 61 74 65 20 74 68 | 65 20 65 78 70 72 65 73 |luate th|e expres|
|00002150| 73 69 6f 6e 0a 5c 69 64 | 65 7b 28 70 72 6f 63 65 |sion.\id|e{(proce|
|00002160| 65 64 29 7d 2e 20 20 54 | 68 65 20 69 6e 74 65 72 |ed)}. T|he inter|
|00002170| 70 72 65 74 65 72 20 77 | 69 6c 6c 20 63 6f 6e 74 |preter w|ill cont|
|00002180| 69 6e 75 65 20 61 73 20 | 74 68 6f 75 67 68 20 74 |inue as |though t|
|00002190| 68 65 0a 62 72 65 61 6b | 70 6f 69 6e 74 20 68 61 |he.break|point ha|
|000021a0| 64 20 6e 6f 74 20 6f 63 | 63 75 72 72 65 64 2e 20 |d not oc|curred. |
|000021b0| 20 49 66 20 74 68 65 20 | 52 45 50 20 6c 6f 6f 70 | If the |REP loop|
|000021c0| 20 77 61 73 20 65 6e 74 | 65 72 65 64 20 62 65 63 | was ent|ered bec|
|000021d0| 61 75 73 65 20 6f 66 20 | 61 0a 7b 5c 74 74 20 62 |ause of |a.{\tt b|
|000021e0| 6b 70 74 7d 20 6f 72 20 | 7b 5c 74 74 20 65 72 72 |kpt} or |{\tt err|
|000021f0| 6f 72 7d 20 73 70 65 63 | 69 61 6c 20 66 6f 72 6d |or} spec|ial form|
|00002200| 2c 20 65 76 61 6c 75 61 | 74 69 6e 67 20 7b 5c 74 |, evalua|ting {\t|
|00002210| 74 20 28 70 72 6f 63 65 | 65 64 0a 5c 76 61 72 7b |t (proce|ed.\var{|
|00002220| 65 78 70 72 65 73 73 69 | 6f 6e 7d 29 7d 20 77 69 |expressi|on})} wi|
|00002230| 6c 6c 20 65 76 61 6c 75 | 61 74 65 20 74 68 65 20 |ll evalu|ate the |
|00002240| 65 78 70 72 65 73 73 69 | 6f 6e 20 61 6e 64 20 72 |expressi|on and r|
|00002250| 65 74 75 72 6e 20 74 68 | 61 74 20 76 61 6c 75 65 |eturn th|at value|
|00002260| 0a 66 6f 72 20 74 68 65 | 20 76 61 6c 75 65 20 6f |.for the| value o|
|00002270| 66 20 74 68 65 20 73 70 | 65 63 69 61 6c 20 66 6f |f the sp|ecial fo|
|00002280| 72 6d 2e 0a 0a 49 66 20 | 74 68 65 20 52 45 50 20 |rm...If |the REP |
|00002290| 6c 6f 6f 70 20 77 61 73 | 20 65 6e 74 65 72 65 64 |loop was| entered|
|000022a0| 20 62 65 63 61 75 73 65 | 20 6f 66 20 61 20 7b 5c | because| of a {\|
|000022b0| 74 74 20 62 72 65 61 6b | 2d 65 6e 74 72 79 7d 20 |tt break|-entry} |
|000022c0| 6f 72 0a 7b 5c 74 74 20 | 62 72 65 61 6b 2d 65 78 |or.{\tt |break-ex|
|000022d0| 69 74 7d 2c 20 7b 5c 74 | 74 20 28 70 72 6f 63 65 |it}, {\t|t (proce|
|000022e0| 65 64 20 5c 76 61 72 7b | 65 78 70 72 65 73 73 69 |ed \var{|expressi|
|000022f0| 6f 6e 7d 29 7d 20 77 69 | 6c 6c 20 65 76 61 6c 75 |on})} wi|ll evalu|
|00002300| 61 74 65 0a 7b 5c 65 6d | 20 65 78 70 72 65 73 73 |ate.{\em| express|
|00002310| 69 6f 6e 7d 20 61 6e 64 | 20 72 65 74 75 72 6e 20 |ion} and| return |
|00002320| 74 68 61 74 20 76 61 6c | 75 65 20 69 6e 20 70 6c |that val|ue in pl|
|00002330| 61 63 65 20 6f 66 20 74 | 68 65 20 76 61 6c 75 65 |ace of t|he value|
|00002340| 20 77 68 69 63 68 20 77 | 6f 75 6c 64 0a 62 65 20 | which w|ould.be |
|00002350| 63 61 6c 63 75 6c 61 74 | 65 64 20 62 79 20 74 68 |calculat|ed by th|
|00002360| 65 20 60 60 62 72 6f 6b | 65 6e 27 27 20 70 72 6f |e ``brok|en'' pro|
|00002370| 63 65 64 75 72 65 2e 20 | 20 54 68 69 73 20 69 73 |cedure. | This is|
|00002380| 20 63 6f 6e 76 65 6e 69 | 65 6e 74 20 69 66 20 79 | conveni|ent if y|
|00002390| 6f 75 0a 72 65 61 6c 69 | 7a 65 20 74 68 61 74 20 |ou.reali|ze that |
|000023a0| 61 20 70 72 6f 63 65 64 | 75 72 65 20 69 73 20 63 |a proced|ure is c|
|000023b0| 61 6c 63 75 6c 61 74 69 | 6e 67 20 74 68 65 20 77 |alculati|ng the w|
|000023c0| 72 6f 6e 67 20 61 6e 73 | 77 65 72 2e 20 59 6f 75 |rong ans|wer. You|
|000023d0| 20 6d 61 79 20 77 61 6e | 74 0a 74 6f 20 71 75 69 | may wan|t.to qui|
|000023e0| 63 6b 6c 79 20 74 72 79 | 20 6f 75 74 20 74 68 65 |ckly try| out the|
|000023f0| 20 72 65 73 74 20 6f 66 | 20 79 6f 75 72 20 70 72 | rest of| your pr|
|00002400| 6f 67 72 61 6d 20 61 73 | 20 74 68 6f 75 67 68 20 |ogram as| though |
|00002410| 74 68 69 73 20 70 72 6f | 63 65 64 75 72 65 0a 72 |this pro|cedure.r|
|00002420| 65 61 6c 6c 79 20 77 6f | 72 6b 65 64 2e 20 20 59 |eally wo|rked. Y|
|00002430| 6f 75 20 63 61 6e 20 7b | 5c 74 74 20 62 72 65 61 |ou can {|\tt brea|
|00002440| 6b 2d 65 6e 74 72 79 7d | 20 74 68 65 20 71 75 65 |k-entry}| the que|
|00002450| 73 74 69 6f 6e 61 62 6c | 65 20 70 72 6f 63 65 64 |stionabl|e proced|
|00002460| 75 72 65 2c 20 61 6e 64 | 0a 74 68 65 6e 20 75 73 |ure, and|.then us|
|00002470| 65 20 7b 5c 74 74 20 28 | 70 72 6f 63 65 65 64 20 |e {\tt (|proceed |
|00002480| 5c 76 61 72 7b 65 78 70 | 72 65 73 73 69 6f 6e 7d |\var{exp|ression}|
|00002490| 29 7d 20 74 6f 20 73 69 | 6d 75 6c 61 74 65 20 74 |)} to si|mulate t|
|000024a0| 68 65 20 77 61 79 20 74 | 68 65 20 70 72 6f 63 65 |he way t|he proce|
|000024b0| 64 75 72 65 0a 73 68 6f | 75 6c 64 20 77 6f 72 6b |dure.sho|uld work|
|000024c0| 2e 0a 0a 49 6e 73 74 65 | 61 64 20 6f 66 20 63 6f |...Inste|ad of co|
|000024d0| 6e 74 69 6e 75 69 6e 67 | 20 74 68 65 20 70 72 6f |ntinuing| the pro|
|000024e0| 67 72 61 6d 20 62 79 20 | 75 73 69 6e 67 20 7b 5c |gram by |using {\|
|000024f0| 74 74 20 70 72 6f 63 65 | 65 64 7d 2c 20 79 6f 75 |tt proce|ed}, you|
|00002500| 20 63 61 6e 20 74 79 70 | 65 0a 5c 63 74 6c 63 7b | can typ|e.\ctlc{|
|00002510| 47 7d 20 77 68 69 63 68 | 20 61 62 6f 72 74 73 20 |G} which| aborts |
|00002520| 65 78 65 63 75 74 69 6f | 6e 20 61 6e 64 20 72 65 |executio|n and re|
|00002530| 74 75 72 6e 73 20 74 6f | 20 74 68 65 20 74 6f 70 |turns to| the top|
|00002540| 2d 6c 65 76 65 6c 0a 52 | 45 50 20 6c 6f 6f 70 2e |-level.R|EP loop.|
|00002550| 20 20 54 68 69 73 20 69 | 73 20 66 72 65 71 75 65 | This i|s freque|
|00002560| 6e 74 6c 79 20 64 6f 6e | 65 20 61 66 74 65 72 20 |ntly don|e after |
|00002570| 60 60 73 6e 6f 6f 70 69 | 6e 67 20 61 72 6f 75 6e |``snoopi|ng aroun|
|00002580| 64 27 27 20 74 6f 0a 64 | 69 73 63 6f 76 65 72 20 |d'' to.d|iscover |
|00002590| 74 68 65 20 70 72 6f 62 | 6c 65 6d 3a 20 74 79 70 |the prob|lem: typ|
|000025a0| 65 20 5c 63 74 6c 63 7b | 47 7d 20 61 6e 64 20 74 |e \ctlc{|G} and t|
|000025b0| 72 79 20 61 67 61 69 6e | 2e 20 20 53 69 6d 69 6c |ry again|. Simil|
|000025c0| 61 72 6c 79 2c 0a 5c 63 | 74 6c 63 7b 55 7d 20 68 |arly,.\c|tlc{U} h|
|000025d0| 61 6c 74 73 20 65 78 65 | 63 75 74 69 6f 6e 20 61 |alts exe|cution a|
|000025e0| 6e 64 20 72 65 74 75 72 | 6e 73 20 74 6f 20 74 68 |nd retur|ns to th|
|000025f0| 65 20 70 72 65 63 65 64 | 69 6e 67 20 28 6c 6f 77 |e preced|ing (low|
|00002600| 65 72 0a 6c 65 76 65 6c | 20 6e 75 6d 62 65 72 29 |er.level| number)|
|00002610| 20 52 45 50 20 6c 6f 6f | 70 2e 20 5c 63 74 6c 63 | REP loo|p. \ctlc|
|00002620| 7b 58 7d 20 72 65 73 75 | 6d 65 73 20 74 68 65 20 |{X} resu|mes the |
|00002630| 63 75 72 72 65 6e 74 20 | 52 45 50 20 6c 6f 6f 70 |current |REP loop|
|00002640| 2e 0a 54 68 69 73 20 69 | 73 20 75 73 65 66 75 6c |..This i|s useful|
|00002650| 2c 20 66 6f 72 20 65 78 | 61 6d 70 6c 65 2c 20 77 |, for ex|ample, w|
|00002660| 68 65 6e 20 79 6f 75 20 | 61 73 6b 20 53 63 68 65 |hen you |ask Sche|
|00002670| 6d 65 20 74 6f 20 70 72 | 65 74 74 79 2d 70 72 69 |me to pr|etty-pri|
|00002680| 6e 74 20 61 0a 6c 6f 6e | 67 20 70 72 6f 63 65 64 |nt a.lon|g proced|
|00002690| 75 72 65 20 61 6e 64 20 | 77 61 6e 74 20 74 6f 20 |ure and |want to |
|000026a0| 73 74 6f 70 20 69 74 20 | 69 6e 20 74 68 65 20 6d |stop it |in the m|
|000026b0| 69 64 64 6c 65 20 6f 66 | 20 74 68 65 20 70 72 69 |iddle of| the pri|
|000026c0| 6e 74 69 6e 67 20 61 6e | 64 0a 67 65 74 20 62 61 |nting an|d.get ba|
|000026d0| 63 6b 20 74 6f 20 74 68 | 65 20 63 75 72 72 65 6e |ck to th|e curren|
|000026e0| 74 20 52 45 50 20 6c 6f | 6f 70 20 70 72 6f 6d 70 |t REP lo|op promp|
|000026f0| 74 2e 0a 0a 46 6f 72 20 | 52 45 50 20 6c 6f 6f 70 |t...For |REP loop|
|00002700| 73 20 63 61 75 73 65 64 | 20 62 79 20 65 72 72 6f |s caused| by erro|
|00002710| 72 73 20 69 6e 20 53 63 | 68 65 6d 65 20 70 72 69 |rs in Sc|heme pri|
|00002720| 6d 69 74 69 76 65 73 2c | 20 65 76 61 6c 75 61 74 |mitives,| evaluat|
|00002730| 69 6e 67 20 7b 5c 74 74 | 0a 28 70 72 6f 63 65 65 |ing {\tt|.(procee|
|00002740| 64 29 7d 20 77 69 6c 6c | 20 73 69 6d 70 6c 79 20 |d)} will| simply |
|00002750| 63 61 6c 6c 20 74 68 65 | 20 70 72 69 6d 69 74 69 |call the| primiti|
|00002760| 76 65 20 61 67 61 69 6e | 2e 20 20 54 68 69 73 20 |ve again|. This |
|00002770| 69 73 20 72 61 72 65 6c | 79 20 77 68 61 74 0a 79 |is rarel|y what.y|
|00002780| 6f 75 20 77 61 6e 74 20 | 74 6f 20 64 6f 2e 20 59 |ou want |to do. Y|
|00002790| 6f 75 20 73 68 6f 75 6c | 64 0a 69 6e 76 65 73 74 |ou shoul|d.invest|
|000027a0| 69 67 61 74 65 20 74 68 | 65 20 70 72 6f 62 6c 65 |igate th|e proble|
|000027b0| 6d 2c 20 66 69 78 20 74 | 68 65 20 70 72 6f 67 72 |m, fix t|he progr|
|000027c0| 61 6d 2c 20 61 6e 64 20 | 74 72 79 20 69 74 20 61 |am, and |try it a|
|000027d0| 6c 6c 20 6f 76 65 72 20 | 61 67 61 69 6e 2e 0a 0a |ll over |again...|
|000027e0| 5c 73 65 63 74 69 6f 6e | 7b 54 72 61 63 65 20 61 |\section|{Trace a|
|000027f0| 6e 64 20 42 72 65 61 6b | 7d 0a 5c 6c 61 62 65 6c |nd Break|}.\label|
|00002800| 7b 74 72 61 63 65 7d 0a | 5c 6c 61 62 65 6c 7b 62 |{trace}.|\label{b|
|00002810| 72 65 61 6b 7d 0a 0a 53 | 63 68 65 6d 65 20 70 72 |reak}..S|cheme pr|
|00002820| 6f 76 69 64 65 73 20 70 | 72 6f 63 65 64 75 72 65 |ovides p|rocedure|
|00002830| 73 20 74 68 61 74 20 61 | 6c 6c 6f 77 20 79 6f 75 |s that a|llow you|
|00002840| 20 74 6f 20 74 72 61 63 | 65 20 74 68 65 20 65 78 | to trac|e the ex|
|00002850| 65 63 75 74 69 6f 6e 20 | 6f 66 20 61 0a 70 72 6f |ecution |of a.pro|
|00002860| 67 72 61 6d 20 61 6e 64 | 20 73 65 74 20 62 72 65 |gram and| set bre|
|00002870| 61 6b 70 6f 69 6e 74 73 | 20 69 6e 20 74 68 65 20 |akpoints| in the |
|00002880| 70 72 6f 67 72 61 6d 2e | 20 20 41 20 70 72 6f 63 |program.| A proc|
|00002890| 65 64 75 72 65 20 63 61 | 6e 20 62 65 20 74 72 61 |edure ca|n be tra|
|000028a0| 63 65 64 0a 6f 6e 20 65 | 6e 74 72 79 20 6f 72 20 |ced.on e|ntry or |
|000028b0| 6f 6e 20 65 78 69 74 2e | 20 20 49 6e 20 61 64 64 |on exit.| In add|
|000028c0| 69 74 69 6f 6e 2c 20 61 | 20 62 72 65 61 6b 70 6f |ition, a| breakpo|
|000028d0| 69 6e 74 20 63 61 6e 20 | 62 65 20 73 65 74 20 77 |int can |be set w|
|000028e0| 68 65 6e 20 74 68 65 0a | 70 72 6f 63 65 64 75 72 |hen the.|procedur|
|000028f0| 65 20 69 73 20 65 6e 74 | 65 72 65 64 20 6f 72 20 |e is ent|ered or |
|00002900| 65 78 69 74 65 64 2e 20 | 20 57 68 65 6e 20 74 68 |exited. | When th|
|00002910| 65 20 65 6e 74 72 79 20 | 6f 66 20 61 20 70 72 6f |e entry |of a pro|
|00002920| 67 72 61 6d 20 69 73 0a | 74 72 61 63 65 64 2c 20 |gram is.|traced, |
|00002930| 74 68 65 20 61 72 67 75 | 6d 65 6e 74 73 20 70 61 |the argu|ments pa|
|00002940| 73 73 65 64 20 74 6f 20 | 69 74 20 61 72 65 20 73 |ssed to |it are s|
|00002950| 68 6f 77 6e 20 61 74 20 | 65 61 63 68 20 65 6e 74 |hown at |each ent|
|00002960| 72 79 2e 20 20 57 68 65 | 6e 20 74 68 65 0a 65 78 |ry. Whe|n the.ex|
|00002970| 69 74 20 6f 66 20 61 20 | 70 72 6f 67 72 61 6d 20 |it of a |program |
|00002980| 69 73 20 74 72 61 63 65 | 64 20 74 68 65 20 61 72 |is trace|d the ar|
|00002990| 67 75 6d 65 6e 74 73 20 | 70 61 73 73 65 64 20 61 |guments |passed a|
|000029a0| 6e 64 20 74 68 65 20 72 | 65 73 75 6c 74 0a 72 65 |nd the r|esult.re|
|000029b0| 74 75 72 6e 65 64 20 61 | 72 65 20 73 68 6f 77 6e |turned a|re shown|
|000029c0| 20 61 74 20 65 61 63 68 | 20 65 78 69 74 2e 20 20 | at each| exit. |
|000029d0| 48 65 72 65 20 69 73 20 | 61 6e 20 65 78 61 6d 70 |Here is |an examp|
|000029e0| 6c 65 2e 20 20 54 68 65 | 20 69 6e 64 69 63 61 74 |le. The| indicat|
|000029f0| 6f 72 73 0a 70 72 65 63 | 65 64 69 6e 67 20 74 68 |ors.prec|eding th|
|00002a00| 65 20 75 73 65 72 27 73 | 20 69 6e 70 75 74 20 73 |e user's| input s|
|00002a10| 68 6f 77 20 74 68 65 20 | 6c 65 76 65 6c 20 61 6e |how the |level an|
|00002a20| 64 20 52 45 50 20 6c 6f | 6f 70 20 69 6e 66 6f 72 |d REP lo|op infor|
|00002a30| 6d 61 74 69 6f 6e 0a 74 | 68 61 74 20 61 70 70 65 |mation.t|hat appe|
|00002a40| 61 72 73 20 69 6e 20 74 | 68 65 20 6d 6f 64 65 20 |ars in t|he mode |
|00002a50| 6c 69 6e 65 20 61 74 20 | 65 61 63 68 20 70 6f 69 |line at |each poi|
|00002a60| 6e 74 2e 0a 5c 62 65 67 | 69 6e 7b 73 63 68 65 6d |nt..\beg|in{schem|
|00002a70| 65 7d 0a 20 5b 31 20 52 | 45 50 5d 20 28 64 65 66 |e}. [1 R|EP] (def|
|00002a80| 69 6e 65 20 28 66 61 63 | 74 20 6e 29 0a 20 20 20 |ine (fac|t n). |
|00002a90| 20 20 20 20 20 20 20 20 | 28 63 6f 6e 64 20 28 28 | |(cond ((|
|00002aa0| 7a 65 72 6f 3f 20 6e 29 | 20 31 29 0a 20 20 20 20 |zero? n)| 1). |
|00002ab0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 28 65 6c | | (el|
|00002ac0| 73 65 20 28 2a 20 6e 20 | 28 66 61 63 74 20 28 2d |se (* n |(fact (-|
|00002ad0| 31 2b 20 6e 29 29 29 29 | 29 29 0a 46 41 43 54 20 |1+ n))))|)).FACT |
|00002ae0| 0a 20 20 20 20 20 0a 20 | 5b 31 20 52 45 50 5d 20 |. . |[1 REP] |
|00002af0| 28 74 72 61 63 65 2d 65 | 6e 74 72 79 20 66 61 63 |(trace-e|ntry fac|
|00002b00| 74 29 0a 20 20 20 20 20 | 0a 20 5b 31 20 52 45 50 |t). |. [1 REP|
|00002b10| 5d 20 28 74 72 61 63 65 | 2d 65 78 69 74 20 66 61 |] (trace|-exit fa|
|00002b20| 63 74 29 0a 0a 20 5b 31 | 20 52 45 50 5d 20 28 66 |ct).. [1| REP] (f|
|00002b30| 61 63 74 20 33 29 0a 20 | 45 6e 74 65 72 69 6e 67 |act 3). |Entering|
|00002b40| 20 3c 5c 23 7b 7d 3c 43 | 4f 4d 50 4f 55 4e 44 2d | <\#{}<C|OMPOUND-|
|00002b50| 50 52 4f 43 45 44 55 52 | 45 20 46 41 43 54 3e 20 |PROCEDUR|E FACT> |
|00002b60| 33 3e 0a 20 45 6e 74 65 | 72 69 6e 67 20 3c 5c 23 |3>. Ente|ring <\#|
|00002b70| 7b 7d 3c 43 4f 4d 50 4f | 55 4e 44 2d 50 52 4f 43 |{}<COMPO|UND-PROC|
|00002b80| 45 44 55 52 45 20 46 41 | 43 54 3e 20 32 3e 0a 20 |EDURE FA|CT> 2>. |
|00002b90| 45 6e 74 65 72 69 6e 67 | 20 3c 5c 23 7b 7d 3c 43 |Entering| <\#{}<C|
|00002ba0| 4f 4d 50 4f 55 4e 44 2d | 50 52 4f 43 45 44 55 52 |OMPOUND-|PROCEDUR|
|00002bb0| 45 20 46 41 43 54 3e 20 | 31 3e 0a 20 45 6e 74 65 |E FACT> |1>. Ente|
|00002bc0| 72 69 6e 67 20 3c 5c 23 | 7b 7d 3c 43 4f 4d 50 4f |ring <\#|{}<COMPO|
|00002bd0| 55 4e 44 2d 50 52 4f 43 | 45 44 55 52 45 20 46 41 |UND-PROC|EDURE FA|
|00002be0| 43 54 3e 20 30 3e 0a 20 | 31 20 3c 3d 3d 20 3c 5c |CT> 0>. |1 <== <\|
|00002bf0| 23 7b 7d 3c 43 4f 4d 50 | 4f 55 4e 44 2d 50 52 4f |#{}<COMP|OUND-PRO|
|00002c00| 43 45 44 55 52 45 20 46 | 41 43 54 3e 20 30 3e 0a |CEDURE F|ACT> 0>.|
|00002c10| 20 31 20 3c 3d 3d 20 3c | 5c 23 7b 7d 3c 43 4f 4d | 1 <== <|\#{}<COM|
|00002c20| 50 4f 55 4e 44 2d 50 52 | 4f 43 45 44 55 52 45 20 |POUND-PR|OCEDURE |
|00002c30| 46 41 43 54 3e 20 31 3e | 0a 20 32 20 3c 3d 3d 20 |FACT> 1>|. 2 <== |
|00002c40| 3c 5c 23 7b 7d 3c 43 4f | 4d 50 4f 55 4e 44 2d 50 |<\#{}<CO|MPOUND-P|
|00002c50| 52 4f 43 45 44 55 52 45 | 20 46 41 43 54 3e 20 32 |ROCEDURE| FACT> 2|
|00002c60| 3e 0a 20 36 20 3c 3d 3d | 20 3c 5c 23 7b 7d 3c 43 |>. 6 <==| <\#{}<C|
|00002c70| 4f 4d 50 4f 55 4e 44 2d | 50 52 4f 43 45 44 55 52 |OMPOUND-|PROCEDUR|
|00002c80| 45 20 46 41 43 54 3e 20 | 33 3e 0a 20 36 0a 0a 20 |E FACT> |3>. 6.. |
|00002c90| 5b 31 20 52 45 50 5d 20 | 28 75 6e 74 72 61 63 65 |[1 REP] |(untrace|
|00002ca0| 20 66 61 63 74 29 0a 0a | 20 5b 31 20 52 45 50 5d | fact)..| [1 REP]|
|00002cb0| 20 28 66 61 63 74 20 33 | 29 0a 20 36 0a 0a 20 5b | (fact 3|). 6.. [|
|00002cc0| 31 20 52 45 50 5d 20 28 | 62 72 65 61 6b 2d 65 78 |1 REP] (|break-ex|
|00002cd0| 69 74 20 66 61 63 74 29 | 0a 0a 20 5b 31 20 52 45 |it fact)|.. [1 RE|
|00002ce0| 50 5d 20 28 66 61 63 74 | 20 32 29 0a 20 31 20 3c |P] (fact| 2). 1 <|
|00002cf0| 3d 3d 20 3c 5c 23 7b 7d | 3c 43 4f 4d 50 4f 55 4e |== <\#{}|<COMPOUN|
|00002d00| 44 2d 50 52 4f 43 45 44 | 55 52 45 20 46 41 43 54 |D-PROCED|URE FACT|
|00002d10| 3e 20 30 3e 0a 20 42 72 | 65 61 6b 70 6f 69 6e 74 |> 0>. Br|eakpoint|
|00002d20| 20 6f 6e 20 65 78 69 74 | 0a 0a 20 5b 32 20 42 72 | on exit|.. [2 Br|
|00002d30| 65 61 6b 5d 20 28 2a 61 | 72 67 73 2a 29 0a 20 28 |eak] (*a|rgs*). (|
|00002d40| 30 29 20 0a 0a 20 5b 32 | 20 42 72 65 61 6b 5d 20 |0) .. [2| Break] |
|00002d50| 28 2a 72 65 73 75 6c 74 | 2a 29 0a 20 31 20 0a 0a |(*result|*). 1 ..|
|00002d60| 20 5b 32 20 42 72 65 61 | 6b 5d 20 28 70 72 6f 63 | [2 Brea|k] (proc|
|00002d70| 65 65 64 20 2d 31 29 20 | 0a 20 2d 31 20 3c 3d 3d |eed -1) |. -1 <==|
|00002d80| 20 3c 5c 23 7b 7d 3c 43 | 4f 4d 50 4f 55 4e 44 2d | <\#{}<C|OMPOUND-|
|00002d90| 50 52 4f 43 45 44 55 52 | 45 20 46 41 43 54 3e 20 |PROCEDUR|E FACT> |
|00002da0| 31 3e 0a 20 42 72 65 61 | 6b 70 6f 69 6e 74 21 20 |1>. Brea|kpoint! |
|00002db0| 4c 65 76 65 6c 3a 20 32 | 0a 0a 20 5b 32 20 42 72 |Level: 2|.. [2 Br|
|00002dc0| 65 61 6b 5d 20 28 70 72 | 6f 63 65 65 64 29 20 0a |eak] (pr|oceed) .|
|00002dd0| 20 2d 32 20 3c 3d 3d 20 | 3c 5c 23 7b 7d 3c 43 4f | -2 <== |<\#{}<CO|
|00002de0| 4d 50 4f 55 4e 44 2d 50 | 52 4f 43 45 44 55 52 45 |MPOUND-P|ROCEDURE|
|00002df0| 20 46 41 43 54 3e 20 32 | 3e 0a 20 42 72 65 61 6b | FACT> 2|>. Break|
|00002e00| 70 6f 69 6e 74 20 6f 6e | 20 65 78 69 74 0a 0a 20 |point on| exit.. |
|00002e10| 5b 32 20 42 72 65 61 6b | 5d 20 28 70 72 6f 63 65 |[2 Break|] (proce|
|00002e20| 65 64 29 20 0a 20 2d 32 | 20 0a 5c 65 6e 64 7b 73 |ed) . -2| .\end{s|
|00002e30| 63 68 65 6d 65 7d 0a 0a | 44 75 72 69 6e 67 20 74 |cheme}..|During t|
|00002e40| 68 65 20 62 72 65 61 6b | 70 6f 69 6e 74 20 69 6e |he break|point in|
|00002e50| 73 65 72 74 65 64 20 62 | 79 20 5c 69 64 65 7b 62 |serted b|y \ide{b|
|00002e60| 72 65 61 6b 2d 65 78 69 | 74 7d 2c 20 74 68 65 20 |reak-exi|t}, the |
|00002e70| 70 72 6f 63 65 64 75 72 | 65 73 0a 5c 69 64 65 7b |procedur|es.\ide{|
|00002e80| 2a 70 72 6f 63 2a 7d 2c | 20 5c 69 64 65 7b 2a 61 |*proc*},| \ide{*a|
|00002e90| 72 67 73 2a 7d 2c 20 61 | 6e 64 20 5c 69 64 65 7b |rgs*}, a|nd \ide{|
|00002ea0| 2a 72 65 73 75 6c 74 2a | 7d 20 63 61 6e 20 62 65 |*result*|} can be|
|00002eb0| 20 63 61 6c 6c 65 64 20 | 74 6f 20 73 65 65 20 74 | called |to see t|
|00002ec0| 68 65 0a 60 60 62 72 6f | 6b 65 6e 27 27 20 70 72 |he.``bro|ken'' pr|
|00002ed0| 6f 63 65 64 75 72 65 2c | 20 74 68 65 20 76 61 6c |ocedure,| the val|
|00002ee0| 75 65 73 20 6f 66 20 74 | 68 65 20 61 72 67 75 6d |ues of t|he argum|
|00002ef0| 65 6e 74 73 2c 20 61 6e | 64 20 74 68 65 20 63 6f |ents, an|d the co|
|00002f00| 6d 70 75 74 65 64 0a 72 | 65 73 75 6c 74 20 28 61 |mputed.r|esult (a|
|00002f10| 76 61 69 6c 61 62 6c 65 | 20 6f 6e 6c 79 20 64 75 |vailable| only du|
|00002f20| 72 69 6e 67 20 61 6e 20 | 65 78 69 74 20 62 72 65 |ring an |exit bre|
|00002f30| 61 6b 29 2c 20 72 65 73 | 70 65 63 74 69 76 65 6c |ak), res|pectivel|
|00002f40| 79 2e 20 20 54 79 70 65 | 0a 7b 5c 74 74 20 28 70 |y. Type|.{\tt (p|
|00002f50| 72 6f 63 65 65 64 29 7d | 20 74 6f 20 70 72 6f 63 |roceed)}| to proc|
|00002f60| 65 65 64 20 66 72 6f 6d | 20 74 68 65 20 62 72 65 |eed from| the bre|
|00002f70| 61 6b 70 6f 69 6e 74 20 | 61 6e 64 20 72 65 74 75 |akpoint |and retu|
|00002f80| 72 6e 20 74 68 65 20 76 | 61 6c 75 65 0a 73 68 6f |rn the v|alue.sho|
|00002f90| 77 6e 20 62 79 20 7b 5c | 74 74 20 28 2a 72 65 73 |wn by {\|tt (*res|
|00002fa0| 75 6c 74 2a 29 7d 2c 20 | 6f 72 20 74 79 70 65 20 |ult*)}, |or type |
|00002fb0| 7b 5c 74 74 20 28 70 72 | 6f 63 65 65 64 20 5c 76 |{\tt (pr|oceed \v|
|00002fc0| 61 72 7b 65 78 70 72 65 | 73 73 69 6f 6e 7d 29 7d |ar{expre|ssion})}|
|00002fd0| 20 74 6f 0a 72 65 74 75 | 72 6e 20 74 68 65 20 76 | to.retu|rn the v|
|00002fe0| 61 6c 75 65 20 6f 66 20 | 5c 76 61 72 7b 65 78 70 |alue of |\var{exp|
|00002ff0| 72 65 73 73 69 6f 6e 7d | 2e 20 20 49 6e 20 74 68 |ression}|. In th|
|00003000| 65 20 61 62 6f 76 65 20 | 65 78 61 6d 70 6c 65 2c |e above |example,|
|00003010| 20 77 65 20 6d 61 64 65 | 0a 7b 5c 74 74 20 28 66 | we made|.{\tt (f|
|00003020| 61 63 74 20 30 29 7d 20 | 72 65 74 75 72 6e 20 24 |act 0)} |return $|
|00003030| 2d 31 24 20 69 6e 73 74 | 65 61 64 20 6f 66 20 31 |-1$ inst|ead of 1|
|00003040| 2e 0a 0a 5c 73 65 63 74 | 69 6f 6e 7b 54 68 65 20 |...\sect|ion{The |
|00003050| 45 6e 76 69 72 6f 6e 6d | 65 6e 74 20 45 78 61 6d |Environm|ent Exam|
|00003060| 69 6e 65 72 3a 20 57 68 | 65 72 65 7d 0a 5c 6c 61 |iner: Wh|ere}.\la|
|00003070| 62 65 6c 7b 77 68 65 72 | 65 73 65 63 74 69 6f 6e |bel{wher|esection|
|00003080| 7d 0a 0a 54 68 65 20 7b | 5c 74 74 20 77 68 65 72 |}..The {|\tt wher|
|00003090| 65 7d 20 70 72 6f 63 65 | 64 75 72 65 20 70 72 6f |e} proce|dure pro|
|000030a0| 76 69 64 65 73 20 61 20 | 6d 65 74 68 6f 64 20 6f |vides a |method o|
|000030b0| 66 20 65 78 61 6d 69 6e | 69 6e 67 20 61 6e 64 20 |f examin|ing and |
|000030c0| 6d 6f 64 69 66 79 69 6e | 67 0a 65 6e 76 69 72 6f |modifyin|g.enviro|
|000030d0| 6e 6d 65 6e 74 73 2e 20 | 20 7b 5c 74 74 20 57 68 |nments. | {\tt Wh|
|000030e0| 65 72 65 7d 20 69 73 20 | 61 20 70 72 6f 63 65 64 |ere} is |a proced|
|000030f0| 75 72 65 20 6f 66 20 30 | 20 6f 72 20 31 20 61 72 |ure of 0| or 1 ar|
|00003100| 67 75 6d 65 6e 74 73 20 | 74 68 61 74 0a 65 6e 74 |guments |that.ent|
|00003110| 65 72 73 20 61 20 72 65 | 61 64 2d 65 78 65 63 75 |ers a re|ad-execu|
|00003120| 74 65 20 63 6f 6d 6d 61 | 6e 64 20 6c 6f 6f 70 20 |te comma|nd loop |
|00003130| 77 68 65 6e 20 63 61 6c | 6c 65 64 2e 20 20 55 6e |when cal|led. Un|
|00003140| 6c 69 6b 65 20 61 20 52 | 45 50 20 6c 6f 6f 70 2c |like a R|EP loop,|
|00003150| 0a 74 68 69 73 20 6c 6f | 6f 70 20 72 65 61 64 73 |.this lo|op reads|
|00003160| 20 6f 6e 65 20 6c 65 74 | 74 65 72 20 61 6e 64 20 | one let|ter and |
|00003170| 74 72 65 61 74 73 20 69 | 74 20 61 73 20 61 20 63 |treats i|t as a c|
|00003180| 6f 6d 6d 61 6e 64 20 74 | 6f 20 62 65 20 70 65 72 |ommand t|o be per|
|00003190| 66 6f 72 6d 65 64 2e 0a | 53 63 68 65 6d 65 20 77 |formed..|Scheme w|
|000031a0| 69 6c 6c 20 70 72 6f 6d | 70 74 20 66 6f 72 20 74 |ill prom|pt for t|
|000031b0| 68 65 20 6f 6e 65 2d 63 | 68 61 72 61 63 74 65 72 |he one-c|haracter|
|000031c0| 20 63 6f 6d 6d 61 6e 64 | 20 61 74 20 74 68 65 20 | command| at the |
|000031d0| 62 6f 74 74 6f 6d 20 6f | 66 20 74 68 65 0a 73 63 |bottom o|f the.sc|
|000031e0| 72 65 65 6e 20 69 6e 20 | 74 68 65 20 45 6d 61 63 |reen in |the Emac|
|000031f0| 73 20 65 63 68 6f 20 61 | 72 65 61 2e 20 20 54 6f |s echo a|rea. To|
|00003200| 20 67 69 76 65 20 61 20 | 63 6f 6d 6d 61 6e 64 2c | give a |command,|
|00003210| 20 6a 75 73 74 20 74 79 | 70 65 20 74 68 65 0a 63 | just ty|pe the.c|
|00003220| 68 61 72 61 63 74 65 72 | 2d 2d 2d 79 6f 75 20 6e |haracter|---you n|
|00003230| 65 65 64 6e 27 74 20 70 | 72 65 73 73 20 7b 5c 73 |eedn't p|ress {\s|
|00003240| 63 20 72 65 74 75 72 6e | 7d 2e 0a 0a 49 66 20 63 |c return|}...If c|
|00003250| 61 6c 6c 65 64 20 77 69 | 74 68 20 6e 6f 20 61 72 |alled wi|th no ar|
|00003260| 67 75 6d 65 6e 74 73 2c | 20 7b 5c 74 74 20 77 68 |guments,| {\tt wh|
|00003270| 65 72 65 7d 20 65 78 61 | 6d 69 6e 65 73 20 74 68 |ere} exa|mines th|
|00003280| 65 20 63 75 72 72 65 6e | 74 20 52 45 50 0a 6c 6f |e curren|t REP.lo|
|00003290| 6f 70 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 2e 20 |op envir|onment. |
|000032a0| 20 54 68 65 20 6f 70 74 | 69 6f 6e 61 6c 20 61 72 | The opt|ional ar|
|000032b0| 67 75 6d 65 6e 74 20 63 | 61 6e 20 62 65 20 61 6e |gument c|an be an|
|000032c0| 20 65 6e 76 69 72 6f 6e | 6d 65 6e 74 20 6f 72 20 | environ|ment or |
|000032d0| 61 6e 0a 6f 62 6a 65 63 | 74 20 77 69 74 68 20 61 |an.objec|t with a|
|000032e0| 6e 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 20 61 73 |n enviro|nment as|
|000032f0| 73 6f 63 69 61 74 65 64 | 20 77 69 74 68 20 69 74 |sociated| with it|
|00003300| 2c 20 73 75 63 68 20 61 | 73 20 61 20 70 72 6f 63 |, such a|s a proc|
|00003310| 65 64 75 72 65 2e 0a 42 | 65 6c 6f 77 20 69 73 20 |edure..B|elow is |
|00003320| 61 6e 20 65 78 61 6d 70 | 6c 65 20 6f 66 20 7b 5c |an examp|le of {\|
|00003330| 74 74 20 77 68 65 72 65 | 7d 20 62 65 69 6e 67 20 |tt where|} being |
|00003340| 63 61 6c 6c 65 64 20 61 | 74 20 61 20 62 72 65 61 |called a|t a brea|
|00003350| 6b 70 6f 69 6e 74 20 69 | 6e 20 61 20 53 63 68 65 |kpoint i|n a Sche|
|00003360| 6d 65 0a 70 72 6f 63 65 | 64 75 72 65 2e 20 20 54 |me.proce|dure. T|
|00003370| 68 69 73 20 69 6c 6c 75 | 73 74 72 61 74 65 73 20 |his illu|strates |
|00003380| 73 6f 6d 65 20 6f 66 20 | 74 68 65 20 74 68 69 6e |some of |the thin|
|00003390| 67 73 20 77 68 69 63 68 | 20 63 61 6e 20 62 65 20 |gs which| can be |
|000033a0| 64 6f 6e 65 20 77 69 74 | 68 0a 7b 5c 74 74 20 77 |done wit|h.{\tt w|
|000033b0| 68 65 72 65 7d 2e 0a 0a | 57 68 69 6c 65 20 74 68 |here}...|While th|
|000033c0| 65 20 7b 5c 74 74 20 77 | 68 65 72 65 7d 20 70 72 |e {\tt w|here} pr|
|000033d0| 6f 63 65 64 75 72 65 20 | 69 73 20 61 20 76 65 72 |ocedure |is a ver|
|000033e0| 79 20 75 73 65 66 75 6c | 20 64 65 62 75 67 67 69 |y useful| debuggi|
|000033f0| 6e 67 20 61 69 64 2c 0a | 75 73 69 6e 67 20 69 74 |ng aid,.|using it|
|00003400| 20 65 66 66 65 63 74 69 | 76 65 6c 79 20 72 65 71 | effecti|vely req|
|00003410| 75 69 72 65 73 20 61 20 | 67 6f 6f 64 0a 75 6e 64 |uires a |good.und|
|00003420| 65 72 73 74 61 6e 64 69 | 6e 67 20 6f 66 20 53 63 |erstandi|ng of Sc|
|00003430| 68 65 6d 65 27 73 20 65 | 6e 76 69 72 6f 6e 6d 65 |heme's e|nvironme|
|00003440| 6e 74 20 73 74 72 75 63 | 74 75 72 65 73 2e 0a 46 |nt struc|tures..F|
|00003450| 6f 72 20 74 68 69 73 20 | 72 65 61 73 6f 6e 20 79 |or this |reason y|
|00003460| 6f 75 20 6d 61 79 20 66 | 69 6e 64 20 69 74 20 6c |ou may f|ind it l|
|00003470| 65 73 73 20 63 6f 6e 66 | 75 73 69 6e 67 20 74 6f |ess conf|using to|
|00003480| 20 75 73 65 0a 6f 6e 6c | 79 20 74 68 65 20 7b 5c | use.onl|y the {\|
|00003490| 74 74 20 43 7d 20 63 6f | 6d 6d 61 6e 64 20 69 6e |tt C} co|mmand in|
|000034a0| 69 74 69 61 6c 6c 79 2e | 0a 0a 48 65 72 65 20 69 |itially.|..Here i|
|000034b0| 73 20 61 20 62 72 69 65 | 66 20 64 65 73 63 72 69 |s a brie|f descri|
|000034c0| 70 74 69 6f 6e 20 6f 66 | 20 65 61 63 68 20 7b 5c |ption of| each {\|
|000034d0| 74 74 20 77 68 65 72 65 | 7d 20 63 6f 6d 6d 61 6e |tt where|} comman|
|000034e0| 64 2e 0a 5c 62 65 67 69 | 6e 7b 64 65 73 63 72 69 |d..\begi|n{descri|
|000034f0| 70 74 69 6f 6e 7d 0a 5c | 69 74 65 6d 20 5b 7b 5c |ption}.\|item [{\|
|00003500| 74 74 20 3f 7d 5d 20 50 | 72 69 6e 74 73 20 61 20 |tt ?}] P|rints a |
|00003510| 73 75 6d 6d 61 72 79 20 | 6f 66 20 74 68 65 20 7b |summary |of the {|
|00003520| 5c 74 74 20 77 68 65 72 | 65 7d 20 63 6f 6d 6d 61 |\tt wher|e} comma|
|00003530| 6e 64 0a 63 68 61 72 61 | 63 74 65 72 73 2e 0a 0a |nd.chara|cters...|
|00003540| 5c 69 74 65 6d 5b 7b 5c | 74 74 20 41 7d 5d 20 28 |\item[{\|tt A}] (|
|00003550| 66 6f 72 20 61 6c 6c 29 | 20 44 69 73 70 6c 61 79 |for all)| Display|
|00003560| 73 20 74 68 65 20 62 69 | 6e 64 69 6e 67 73 20 69 |s the bi|ndings i|
|00003570| 6e 20 61 6c 6c 20 6f 66 | 20 74 68 65 20 66 72 61 |n all of| the fra|
|00003580| 6d 65 73 0a 69 6e 20 74 | 68 65 20 63 75 72 72 65 |mes.in t|he curre|
|00003590| 6e 74 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 20 63 |nt envir|onment c|
|000035a0| 68 61 69 6e 2e 0a 0a 5c | 69 74 65 6d 20 5b 7b 5c |hain...\|item [{\|
|000035b0| 74 74 20 43 7d 5d 20 28 | 66 6f 72 20 63 75 72 72 |tt C}] (|for curr|
|000035c0| 65 6e 74 29 20 44 69 73 | 70 6c 61 79 73 20 74 68 |ent) Dis|plays th|
|000035d0| 65 20 62 69 6e 64 69 6e | 67 73 20 69 6e 20 74 68 |e bindin|gs in th|
|000035e0| 65 20 63 75 72 72 65 6e | 74 20 66 72 61 6d 65 2e |e curren|t frame.|
|000035f0| 0a 0a 5c 69 74 65 6d 20 | 5b 7b 5c 74 74 20 45 7d |..\item |[{\tt E}|
|00003600| 5d 20 28 66 6f 72 20 65 | 76 61 6c 29 20 45 6e 74 |] (for e|val) Ent|
|00003610| 65 72 73 20 61 20 52 45 | 50 20 6c 6f 6f 70 20 69 |ers a RE|P loop i|
|00003620| 6e 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 65 6e |n the cu|rrent en|
|00003630| 76 69 72 6f 6e 6d 65 6e | 74 2e 0a 0a 5c 69 74 65 |vironmen|t...\ite|
|00003640| 6d 20 5b 7b 5c 74 74 20 | 4e 7d 5d 20 28 66 6f 72 |m [{\tt |N}] (for|
|00003650| 20 6e 61 6d 65 29 20 53 | 68 6f 77 73 20 74 68 65 | name) S|hows the|
|00003660| 20 6e 61 6d 65 20 6f 66 | 20 70 72 6f 63 65 64 75 | name of| procedu|
|00003670| 72 65 20 74 68 61 74 20 | 63 72 65 61 74 65 64 0a |re that |created.|
|00003680| 63 75 72 72 65 6e 74 20 | 65 6e 76 69 72 6f 6e 6d |current |environm|
|00003690| 65 6e 74 20 66 72 61 6d | 65 2e 0a 0a 5c 69 74 65 |ent fram|e...\ite|
|000036a0| 6d 20 5b 7b 5c 74 74 20 | 50 7d 5d 20 28 66 6f 72 |m [{\tt |P}] (for|
|000036b0| 20 70 61 72 65 6e 74 29 | 20 4d 6f 76 65 73 20 75 | parent)| Moves u|
|000036c0| 70 20 74 6f 20 74 68 65 | 20 70 61 72 65 6e 74 20 |p to the| parent |
|000036d0| 6f 66 20 74 68 65 20 63 | 75 72 72 65 6e 74 0a 65 |of the c|urrent.e|
|000036e0| 6e 76 69 72 6f 6e 6d 65 | 6e 74 20 66 72 61 6d 65 |nvironme|nt frame|
|000036f0| 2c 20 74 68 65 6e 20 64 | 6f 65 73 20 61 20 43 20 |, then d|oes a C |
|00003700| 63 6f 6d 6d 61 6e 64 2e | 0a 0a 5c 69 74 65 6d 20 |command.|..\item |
|00003710| 5b 7b 5c 74 74 20 51 7d | 5d 20 28 66 6f 72 20 71 |[{\tt Q}|] (for q|
|00003720| 75 69 74 29 20 45 78 69 | 74 73 20 7b 5c 74 74 20 |uit) Exi|ts {\tt |
|00003730| 77 68 65 72 65 7d 2e 0a | 0a 5c 69 74 65 6d 20 5b |where}..|.\item [|
|00003740| 7b 5c 74 74 20 53 7d 5d | 20 28 66 6f 72 20 73 6f |{\tt S}]| (for so|
|00003750| 6e 29 20 4d 6f 76 65 20 | 74 6f 20 74 68 65 20 73 |n) Move |to the s|
|00003760| 6f 6e 20 6f 66 20 74 68 | 65 20 63 75 72 72 65 6e |on of th|e curren|
|00003770| 74 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 0a 66 72 |t enviro|nment.fr|
|00003780| 61 6d 65 2e 20 54 68 69 | 73 20 75 6e 64 6f 65 73 |ame. Thi|s undoes|
|00003790| 20 61 20 50 20 63 6f 6d | 6d 61 6e 64 2e 0a 0a 5c | a P com|mand...\|
|000037a0| 69 74 65 6d 20 5b 7b 5c | 74 74 20 56 7d 5d 20 28 |item [{\|tt V}] (|
|000037b0| 66 6f 72 20 76 61 6c 75 | 65 29 20 45 76 61 6c 75 |for valu|e) Evalu|
|000037c0| 61 74 65 73 20 6f 6e 65 | 20 65 78 70 72 65 73 73 |ates one| express|
|000037d0| 69 6f 6e 20 69 6e 20 74 | 68 65 20 63 75 72 72 65 |ion in t|he curre|
|000037e0| 6e 74 20 66 72 61 6d 65 | 0a 61 6e 64 20 20 70 72 |nt frame|.and pr|
|000037f0| 65 74 74 79 2d 70 72 69 | 6e 74 73 20 74 68 65 20 |etty-pri|nts the |
|00003800| 72 65 73 75 6c 74 2e 0a | 0a 5c 69 74 65 6d 20 5b |result..|.\item [|
|00003810| 7b 5c 74 74 20 57 7d 5d | 20 28 66 6f 72 20 7b 5c |{\tt W}]| (for {\|
|00003820| 74 74 20 77 68 65 72 65 | 7d 29 20 45 76 61 6c 75 |tt where|}) Evalu|
|00003830| 61 74 65 20 61 6e 20 65 | 78 70 72 65 73 73 69 6f |ate an e|xpressio|
|00003840| 6e 20 69 6e 20 74 68 65 | 20 63 75 72 72 65 6e 74 |n in the| current|
|00003850| 0a 66 72 61 6d 65 20 61 | 6e 64 20 63 61 6c 6c 20 |.frame a|nd call |
|00003860| 7b 5c 74 74 20 77 68 65 | 72 65 7d 20 6f 6e 20 74 |{\tt whe|re} on t|
|00003870| 68 65 20 72 65 73 75 6c | 74 2e 0a 5c 65 6e 64 7b |he resul|t..\end{|
|00003880| 64 65 73 63 72 69 70 74 | 69 6f 6e 7d 0a 0a 48 65 |descript|ion}..He|
|00003890| 72 65 20 69 73 20 61 6e | 20 65 78 61 6d 70 6c 65 |re is an| example|
|000038a0| 20 6f 66 20 75 73 69 6e | 67 20 7b 5c 74 74 20 77 | of usin|g {\tt w|
|000038b0| 68 65 72 65 7d 2e 20 20 | 54 68 65 20 69 6e 64 69 |here}. |The indi|
|000038c0| 63 61 74 6f 72 73 20 61 | 74 20 74 68 65 20 6c 65 |cators a|t the le|
|000038d0| 66 74 0a 6f 66 20 74 68 | 65 20 75 73 65 72 20 69 |ft.of th|e user i|
|000038e0| 6e 70 75 74 20 73 68 6f | 77 20 74 68 65 20 69 6e |nput sho|w the in|
|000038f0| 66 6f 72 6d 61 74 69 6f | 6e 20 74 68 61 74 20 77 |formatio|n that w|
|00003900| 6f 75 6c 64 20 61 70 70 | 65 61 72 20 69 6e 20 74 |ould app|ear in t|
|00003910| 68 65 20 62 75 66 66 65 | 72 0a 6d 6f 64 65 20 6c |he buffe|r.mode l|
|00003920| 69 6e 65 2c 20 61 6e 64 | 20 69 6e 20 74 68 65 20 |ine, and| in the |
|00003930| 70 72 6f 6d 70 74 73 20 | 69 6e 20 74 68 65 20 65 |prompts |in the e|
|00003940| 63 68 6f 20 61 72 65 61 | 3a 0a 5c 62 65 67 69 6e |cho area|:.\begin|
|00003950| 7b 73 63 68 65 6d 65 7d | 0a 20 5b 31 20 52 45 50 |{scheme}|. [1 REP|
|00003960| 5d 20 28 64 65 66 69 6e | 65 20 28 6f 6e 65 20 78 |] (defin|e (one x|
|00003970| 20 79 20 7a 29 20 0a 20 | 20 20 20 20 20 20 20 20 | y z) . | |
|00003980| 20 20 28 64 65 66 69 6e | 65 20 28 74 77 6f 20 78 | (defin|e (two x|
|00003990| 20 79 20 7a 29 0a 20 20 | 20 20 20 20 20 20 20 20 | y z). | |
|000039a0| 20 20 20 28 64 65 66 69 | 6e 65 20 28 74 68 72 65 | (defi|ne (thre|
|000039b0| 65 20 78 20 79 20 7a 29 | 0a 20 20 20 20 20 20 20 |e x y z)|. |
|000039c0| 20 20 20 20 20 20 20 20 | 28 62 6b 70 74 20 22 49 | |(bkpt "I|
|000039d0| 6e 20 70 72 6f 63 65 64 | 75 72 65 20 74 68 72 65 |n proced|ure thre|
|000039e0| 65 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 22 0a 20 |e enviro|nment". |
|000039f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003a00| 20 20 20 20 28 6c 69 73 | 74 20 78 20 79 20 7a 29 | (lis|t x y z)|
|00003a10| 29 29 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |)). | |
|00003a20| 28 74 68 72 65 65 20 31 | 20 32 20 33 29 29 0a 20 |(three 1| 2 3)). |
|00003a30| 20 20 20 20 20 20 20 20 | 20 20 28 74 77 6f 20 34 | | (two 4|
|00003a40| 20 35 20 36 29 29 0a 20 | 20 20 20 20 0a 20 4f 4e | 5 6)). | . ON|
|00003a50| 45 20 0a 20 20 20 20 20 | 0a 20 5b 31 20 52 45 50 |E . |. [1 REP|
|00003a60| 5d 20 28 6f 6e 65 20 27 | 61 20 27 62 20 27 63 29 |] (one '|a 'b 'c)|
|00003a70| 0a 20 49 6e 20 70 72 6f | 63 65 64 75 72 65 20 74 |. In pro|cedure t|
|00003a80| 68 72 65 65 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 |hree env|ironment|
|00003a90| 20 28 31 20 32 20 33 29 | 0a 20 42 72 65 61 6b 70 | (1 2 3)|. Breakp|
|00003aa0| 6f 69 6e 74 0a 0a 20 5b | 32 20 42 72 65 61 6b 5d |oint.. [|2 Break]|
|00003ab0| 20 28 77 68 65 72 65 29 | 0a 20 45 6e 76 69 72 6f | (where)|. Enviro|
|00003ac0| 6e 6d 65 6e 74 20 49 6e | 73 70 65 63 74 6f 72 0a |nment In|spector.|
|00003ad0| 20 5b 33 20 57 68 65 72 | 65 5d 20 63 0a 20 46 72 | [3 Wher|e] c. Fr|
|00003ae0| 61 6d 65 20 63 72 65 61 | 74 65 64 20 62 79 20 74 |ame crea|ted by t|
|00003af0| 68 65 20 70 72 6f 63 65 | 64 75 72 65 20 54 48 52 |he proce|dure THR|
|00003b00| 45 45 2e 0a 20 44 65 70 | 74 68 20 28 72 65 6c 61 |EE.. Dep|th (rela|
|00003b10| 74 69 76 65 20 74 6f 20 | 73 74 61 72 74 69 6e 67 |tive to |starting|
|00003b20| 20 66 72 61 6d 65 29 3a | 20 30 0a 20 48 61 73 20 | frame):| 0. Has |
|00003b30| 62 69 6e 64 69 6e 67 73 | 3a 0a 20 20 20 20 20 0a |bindings|:. .|
|00003b40| 20 58 20 3d 20 31 0a 20 | 59 20 3d 20 32 0a 20 5a | X = 1. |Y = 2. Z|
|00003b50| 20 3d 20 33 0a 5c 65 6e | 64 7b 73 63 68 65 6d 65 | = 3.\en|d{scheme|
|00003b60| 7d 0a 0a 0a 54 68 65 20 | 43 20 63 6f 6d 6d 61 6e |}...The |C comman|
|00003b70| 64 20 70 72 69 6e 74 73 | 20 74 68 65 20 76 61 72 |d prints| the var|
|00003b80| 69 61 62 6c 65 20 62 69 | 6e 64 69 6e 67 73 20 69 |iable bi|ndings i|
|00003b90| 6e 20 74 68 65 20 63 75 | 72 72 65 6e 74 6c 79 0a |n the cu|rrently.|
|00003ba0| 73 65 6c 65 63 74 65 64 | 20 65 6e 76 69 72 6f 6e |selected| environ|
|00003bb0| 6d 65 6e 74 20 66 72 61 | 6d 65 2e 20 20 53 69 6e |ment fra|me. Sin|
|00003bc0| 63 65 20 74 68 65 20 62 | 72 65 61 6b 70 6f 69 6e |ce the b|reakpoin|
|00003bd0| 74 20 6f 63 63 75 72 72 | 65 64 20 69 6e 73 69 64 |t occurr|ed insid|
|00003be0| 65 20 74 68 65 0a 65 78 | 65 63 75 74 69 6f 6e 20 |e the.ex|ecution |
|00003bf0| 6f 66 20 74 68 65 20 70 | 72 6f 63 65 64 75 72 65 |of the p|rocedure|
|00003c00| 20 7b 5c 74 74 20 74 68 | 72 65 65 7d 2c 20 74 68 | {\tt th|ree}, th|
|00003c10| 65 20 63 75 72 72 65 6e | 74 20 65 6e 76 69 72 6f |e curren|t enviro|
|00003c20| 6e 6d 65 6e 74 20 69 73 | 20 74 68 65 20 6f 6e 65 |nment is| the one|
|00003c30| 0a 72 65 73 75 6c 74 69 | 6e 67 20 66 72 6f 6d 20 |.resulti|ng from |
|00003c40| 74 68 65 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |the appl|ication |
|00003c50| 6f 66 20 43 20 74 6f 20 | 74 68 65 20 61 72 67 75 |of C to |the argu|
|00003c60| 6d 65 6e 74 73 20 31 20 | 32 20 33 2e 0a 0a 54 68 |ments 1 |2 3...Th|
|00003c70| 65 20 50 20 63 6f 6d 6d | 61 6e 64 20 6d 6f 76 65 |e P comm|and move|
|00003c80| 73 20 74 6f 20 74 68 65 | 20 66 72 61 6d 65 20 69 |s to the| frame i|
|00003c90| 6e 20 77 68 69 63 68 20 | 7b 5c 74 74 20 74 68 72 |n which |{\tt thr|
|00003ca0| 65 65 7d 20 77 61 73 20 | 64 65 66 69 6e 65 64 2e |ee} was |defined.|
|00003cb0| 20 20 49 6e 0a 74 68 69 | 73 20 63 61 73 65 20 74 | In.thi|s case t|
|00003cc0| 68 65 20 70 61 72 65 6e | 74 20 69 73 20 74 68 65 |he paren|t is the|
|00003cd0| 20 66 72 61 6d 65 20 63 | 72 65 61 74 65 64 20 62 | frame c|reated b|
|00003ce0| 79 20 74 68 65 20 61 70 | 70 6c 69 63 61 74 69 6f |y the ap|plicatio|
|00003cf0| 6e 20 6f 66 20 74 68 65 | 0a 70 72 6f 63 65 64 75 |n of the|.procedu|
|00003d00| 72 65 20 7b 5c 74 74 20 | 74 77 6f 7d 20 74 6f 20 |re {\tt |two} to |
|00003d10| 74 68 65 20 61 72 67 75 | 6d 65 6e 74 73 20 34 20 |the argu|ments 4 |
|00003d20| 35 20 36 2e 0a 5c 62 65 | 67 69 6e 7b 73 63 68 65 |5 6..\be|gin{sche|
|00003d30| 6d 65 7d 20 20 20 20 20 | 0a 20 5b 33 20 57 68 65 |me} |. [3 Whe|
|00003d40| 72 65 5d 20 70 0a 20 46 | 72 61 6d 65 20 63 72 65 |re] p. F|rame cre|
|00003d50| 61 74 65 64 20 62 79 20 | 74 68 65 20 70 72 6f 63 |ated by |the proc|
|00003d60| 65 64 75 72 65 20 54 57 | 4f 2e 0a 20 44 65 70 74 |edure TW|O.. Dept|
|00003d70| 68 20 28 72 65 6c 61 74 | 69 76 65 20 74 6f 20 73 |h (relat|ive to s|
|00003d80| 74 61 72 74 69 6e 67 20 | 66 72 61 6d 65 29 3a 20 |tarting |frame): |
|00003d90| 31 0a 20 48 61 73 20 62 | 69 6e 64 69 6e 67 73 3a |1. Has b|indings:|
|00003da0| 0a 0a 20 58 20 3d 20 34 | 0a 20 59 20 3d 20 35 0a |.. X = 4|. Y = 5.|
|00003db0| 20 5a 20 3d 20 36 0a 20 | 54 48 52 45 45 20 3d 20 | Z = 6. |THREE = |
|00003dc0| 5c 23 7b 7d 3c 43 4f 4d | 50 4f 55 4e 44 2d 50 52 |\#{}<COM|POUND-PR|
|00003dd0| 4f 43 45 44 55 52 45 20 | 54 48 52 45 45 3e 0a 0a |OCEDURE |THREE>..|
|00003de0| 20 20 20 20 20 0a 20 5b | 33 20 57 68 65 72 65 5d | . [|3 Where]|
|00003df0| 20 70 0a 20 46 72 61 6d | 65 20 63 72 65 61 74 65 | p. Fram|e create|
|00003e00| 64 20 62 79 20 74 68 65 | 20 70 72 6f 63 65 64 75 |d by the| procedu|
|00003e10| 72 65 20 4f 4e 45 2e 0a | 20 44 65 70 74 68 20 28 |re ONE..| Depth (|
|00003e20| 72 65 6c 61 74 69 76 65 | 20 74 6f 20 73 74 61 72 |relative| to star|
|00003e30| 74 69 6e 67 20 66 72 61 | 6d 65 29 3a 20 32 0a 20 |ting fra|me): 2. |
|00003e40| 48 61 73 20 62 69 6e 64 | 69 6e 67 73 3a 0a 20 20 |Has bind|ings:. |
|00003e50| 20 20 20 0a 20 58 20 3d | 20 41 0a 20 59 20 3d 20 | . X =| A. Y = |
|00003e60| 42 0a 20 5a 20 3d 20 43 | 0a 20 54 57 4f 20 3d 20 |B. Z = C|. TWO = |
|00003e70| 5c 23 7b 7d 3c 43 4f 4d | 50 4f 55 4e 44 2d 50 52 |\#{}<COM|POUND-PR|
|00003e80| 4f 43 45 44 55 52 45 20 | 54 57 4f 3e 0a 20 20 20 |OCEDURE |TWO>. |
|00003e90| 20 20 0a 20 20 20 20 20 | 0a 20 5b 33 20 57 68 65 | . |. [3 Whe|
|00003ea0| 72 65 5d 20 70 0a 20 46 | 72 61 6d 65 20 63 72 65 |re] p. F|rame cre|
|00003eb0| 61 74 65 64 20 62 79 20 | 61 20 4d 41 4b 45 2d 50 |ated by |a MAKE-P|
|00003ec0| 41 43 4b 41 47 45 20 73 | 70 65 63 69 61 6c 20 66 |ACKAGE s|pecial f|
|00003ed0| 6f 72 6d 2e 0a 20 44 65 | 70 74 68 20 28 72 65 6c |orm.. De|pth (rel|
|00003ee0| 61 74 69 76 65 20 74 6f | 20 73 74 61 72 74 69 6e |ative to| startin|
|00003ef0| 67 20 66 72 61 6d 65 29 | 3a 20 33 0a 20 48 61 73 |g frame)|: 3. Has|
|00003f00| 20 62 69 6e 64 69 6e 67 | 73 3a 0a 0a 20 55 53 45 | binding|s:.. USE|
|00003f10| 52 2d 49 4e 49 54 49 41 | 4c 2d 45 4e 56 49 52 4f |R-INITIA|L-ENVIRO|
|00003f20| 4e 4d 45 4e 54 20 3d 20 | 5c 23 7b 7d 3c 45 4e 56 |NMENT = |\#{}<ENV|
|00003f30| 49 52 4f 4e 4d 45 4e 54 | 20 31 33 36 37 39 31 32 |IRONMENT| 1367912|
|00003f40| 34 3e 0a 20 4f 4e 45 20 | 3d 20 5c 23 7b 7d 3c 43 |4>. ONE |= \#{}<C|
|00003f50| 4f 4d 50 4f 55 4e 44 2d | 50 52 4f 43 45 44 55 52 |OMPOUND-|PROCEDUR|
|00003f60| 45 20 4f 4e 45 3e 0a 5c | 65 6e 64 7b 73 63 68 65 |E ONE>.\|end{sche|
|00003f70| 6d 65 7d 20 20 20 20 20 | 0a 48 65 72 65 20 77 65 |me} |.Here we|
|00003f80| 20 68 61 76 65 20 72 65 | 61 63 68 65 64 20 74 68 | have re|ached th|
|00003f90| 65 20 75 73 65 72 20 69 | 6e 69 74 69 61 6c 20 65 |e user i|nitial e|
|00003fa0| 6e 76 69 72 6f 6e 6d 65 | 6e 74 20 69 6e 20 77 68 |nvironme|nt in wh|
|00003fb0| 69 63 68 20 74 68 65 20 | 74 6f 70 0a 6d 6f 73 74 |ich the |top.most|
|00003fc0| 20 70 72 6f 63 65 64 75 | 72 65 20 7b 5c 74 74 20 | procedu|re {\tt |
|00003fd0| 6f 6e 65 7d 20 77 61 73 | 20 64 65 66 69 6e 65 64 |one} was| defined|
|00003fe0| 2e 20 20 54 68 61 74 27 | 73 20 65 6e 6f 75 67 68 |. That'|s enough|
|00003ff0| 20 24 5c 6c 64 6f 74 73 | 24 0a 5c 62 65 67 69 6e | $\ldots|$.\begin|
|00004000| 7b 73 63 68 65 6d 65 7d | 0a 20 5b 33 20 57 68 65 |{scheme}|. [3 Whe|
|00004010| 72 65 5d 20 71 0a 5c 65 | 6e 64 7b 73 63 68 65 6d |re] q.\e|nd{schem|
|00004020| 65 7d 0a 5c 6e 6f 69 6e | 64 65 6e 74 0a 61 6e 64 |e}.\noin|dent.and|
|00004030| 20 77 65 20 61 72 65 20 | 62 61 63 6b 20 69 6e 20 | we are |back in |
|00004040| 74 68 65 20 52 45 50 20 | 6c 6f 6f 70 20 77 68 65 |the REP |loop whe|
|00004050| 72 65 20 77 65 20 73 74 | 61 72 74 65 64 2e 20 20 |re we st|arted. |
|00004060| 57 65 20 63 61 6e 20 63 | 6f 6e 74 69 6e 75 65 0a |We can c|ontinue.|
|00004070| 74 68 65 20 70 72 6f 67 | 72 61 6d 20 62 79 20 74 |the prog|ram by t|
|00004080| 79 70 69 6e 67 20 7b 5c | 74 74 20 28 70 72 6f 63 |yping {\|tt (proc|
|00004090| 65 65 64 29 7d 2e 0a 0a | 4e 6f 74 69 63 65 20 74 |eed)}...|Notice t|
|000040a0| 68 61 74 20 77 65 20 63 | 6f 75 6c 64 20 73 74 6f |hat we c|ould sto|
|000040b0| 70 20 61 74 20 61 6e 79 | 20 65 6e 76 69 72 6f 6e |p at any| environ|
|000040c0| 6d 65 6e 74 20 61 6e 64 | 20 63 72 65 61 74 65 20 |ment and| create |
|000040d0| 61 20 52 45 50 20 6c 6f | 6f 70 20 69 6e 0a 69 74 |a REP lo|op in.it|
|000040e0| 20 62 79 20 75 73 69 6e | 67 20 74 68 65 20 45 20 | by usin|g the E |
|000040f0| 63 6f 6d 6d 61 6e 64 2e | 20 20 54 68 69 73 20 61 |command.| This a|
|00004100| 6c 6c 6f 77 73 20 79 6f | 75 2c 20 66 6f 72 20 65 |llows yo|u, for e|
|00004110| 78 61 6d 70 6c 65 2c 20 | 74 6f 20 64 65 66 69 6e |xample, |to defin|
|00004120| 65 0a 6d 69 73 73 69 6e | 67 20 76 61 72 69 61 62 |e.missin|g variab|
|00004130| 6c 65 73 20 77 68 65 6e | 20 79 6f 75 20 65 6e 63 |les when| you enc|
|00004140| 6f 75 6e 74 65 72 20 61 | 6e 20 7b 5c 74 74 20 75 |ounter a|n {\tt u|
|00004150| 6e 62 6f 75 6e 64 20 76 | 61 72 69 61 62 6c 65 7d |nbound v|ariable}|
|00004160| 20 65 72 72 6f 72 2e 0a | 53 69 6d 69 6c 61 72 6c | error..|Similarl|
|00004170| 79 2c 20 79 6f 75 20 63 | 61 6e 20 75 73 65 20 74 |y, you c|an use t|
|00004180| 68 65 20 7b 5c 74 74 20 | 56 7d 20 28 6f 6e 65 20 |he {\tt |V} (one |
|00004190| 65 78 70 72 65 73 73 69 | 6f 6e 29 20 63 6f 6d 6d |expressi|on) comm|
|000041a0| 61 6e 64 20 74 6f 20 65 | 76 61 6c 75 61 74 65 20 |and to e|valuate |
|000041b0| 61 0a 73 69 6e 67 6c 65 | 20 65 78 70 72 65 73 73 |a.single| express|
|000041c0| 69 6f 6e 20 69 6e 20 61 | 6e 79 20 6f 66 20 74 68 |ion in a|ny of th|
|000041d0| 65 20 66 72 61 6d 65 73 | 20 69 6e 20 74 68 65 20 |e frames| in the |
|000041e0| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 20 63 68 61 69 |environm|ent chai|
|000041f0| 6e 2e 0a 0a 5c 73 65 63 | 74 69 6f 6e 7b 54 68 65 |n...\sec|tion{The|
|00004200| 20 53 63 68 65 6d 65 20 | 44 65 62 75 67 67 65 72 | Scheme |Debugger|
|00004210| 3a 20 44 65 62 75 67 7d | 0a 5c 6c 61 62 65 6c 7b |: Debug}|.\label{|
|00004220| 64 65 62 75 67 73 65 63 | 74 69 6f 6e 7d 0a 0a 41 |debugsec|tion}..A|
|00004230| 20 62 72 65 61 6b 70 6f | 69 6e 74 20 77 69 6c 6c | breakpo|int will|
|00004240| 20 61 6c 6c 6f 77 20 79 | 6f 75 20 6f 6e 6c 79 20 | allow y|ou only |
|00004250| 74 6f 20 65 78 61 6d 69 | 6e 65 20 6c 6f 63 61 6c |to exami|ne local|
|00004260| 20 76 61 72 69 61 62 6c | 65 73 0a 61 6e 64 20 74 | variabl|es.and t|
|00004270| 6f 20 65 76 61 6c 75 61 | 74 65 20 65 78 70 72 65 |o evalua|te expre|
|00004280| 73 73 69 6f 6e 73 20 61 | 74 20 74 68 65 20 62 72 |ssions a|t the br|
|00004290| 65 61 6b 70 6f 69 6e 74 | 2e 20 20 4f 66 74 65 6e |eakpoint|. Often|
|000042a0| 2c 20 68 6f 77 65 76 65 | 72 2c 0a 74 72 61 63 6b |, howeve|r,.track|
|000042b0| 69 6e 67 20 64 6f 77 6e | 20 61 20 62 75 67 20 77 |ing down| a bug w|
|000042c0| 69 6c 6c 20 72 65 71 75 | 69 72 65 20 61 20 6d 6f |ill requ|ire a mo|
|000042d0| 72 65 20 65 78 74 65 6e | 73 69 76 65 20 69 6e 76 |re exten|sive inv|
|000042e0| 65 73 74 69 67 61 74 69 | 6f 6e 20 6f 66 0a 74 68 |estigati|on of.th|
|000042f0| 65 20 63 69 72 63 75 6d | 73 74 61 6e 63 65 73 20 |e circum|stances |
|00004300| 73 75 72 72 6f 75 6e 64 | 69 6e 67 20 74 68 65 20 |surround|ing the |
|00004310| 65 72 72 6f 72 2e 20 20 | 54 68 65 20 53 63 68 65 |error. |The Sche|
|00004320| 6d 65 20 64 65 62 75 67 | 67 65 72 20 73 79 73 74 |me debug|ger syst|
|00004330| 65 6d 0a 70 72 6f 76 69 | 64 65 73 20 61 64 64 69 |em.provi|des addi|
|00004340| 74 69 6f 6e 61 6c 20 63 | 61 70 61 62 69 6c 69 74 |tional c|apabilit|
|00004350| 69 65 73 20 74 6f 20 61 | 69 64 20 69 6e 20 64 65 |ies to a|id in de|
|00004360| 62 75 67 67 69 6e 67 2e | 0a 0a 54 68 65 20 68 69 |bugging.|..The hi|
|00004370| 73 74 6f 72 79 20 65 78 | 61 6d 69 6e 65 72 2c 20 |story ex|aminer, |
|00004380| 65 6e 74 65 72 65 64 20 | 75 73 69 6e 67 20 74 68 |entered |using th|
|00004390| 65 20 7b 5c 74 74 20 64 | 65 62 75 67 7d 20 63 6f |e {\tt d|ebug} co|
|000043a0| 6d 6d 61 6e 64 2c 20 65 | 6e 61 62 6c 65 73 20 79 |mmand, e|nables y|
|000043b0| 6f 75 0a 74 6f 20 65 78 | 61 6d 69 6e 65 20 74 68 |ou.to ex|amine th|
|000043c0| 65 20 68 69 73 74 6f 72 | 79 20 6f 66 20 65 78 65 |e histor|y of exe|
|000043d0| 63 75 74 69 6f 6e 20 6f | 66 20 61 6e 20 65 78 70 |cution o|f an exp|
|000043e0| 72 65 73 73 69 6f 6e 2e | 20 20 54 68 65 20 65 6e |ression.| The en|
|000043f0| 76 69 72 6f 6e 6d 65 6e | 74 0a 6f 66 20 61 6e 79 |vironmen|t.of any|
|00004400| 20 70 72 6f 63 65 64 75 | 72 65 20 61 70 70 6c 69 | procedu|re appli|
|00004410| 63 61 74 69 6f 6e 20 6d | 61 79 20 74 68 65 6e 20 |cation m|ay then |
|00004420| 62 65 20 65 78 61 6d 69 | 6e 65 64 20 61 6e 64 20 |be exami|ned and |
|00004430| 74 68 65 20 69 6e 74 65 | 72 72 75 70 74 65 64 0a |the inte|rrupted.|
|00004440| 70 72 6f 63 65 73 73 20 | 6d 61 79 20 62 65 20 63 |process |may be c|
|00004450| 6f 6e 74 69 6e 75 65 64 | 20 66 72 6f 6d 20 61 6e |ontinued| from an|
|00004460| 79 20 6f 66 20 74 68 65 | 20 64 69 73 70 6c 61 79 |y of the| display|
|00004470| 65 64 20 6e 6f 64 65 73 | 20 6f 66 0a 65 76 61 6c |ed nodes| of.eval|
|00004480| 75 61 74 69 6f 6e 2e 0a | 0a 43 61 6c 6c 69 6e 67 |uation..|.Calling|
|00004490| 20 74 68 65 20 7b 5c 74 | 74 20 64 65 62 75 67 7d | the {\t|t debug}|
|000044a0| 20 70 72 6f 63 65 64 75 | 72 65 20 66 72 6f 6d 20 | procedu|re from |
|000044b0| 77 69 74 68 69 6e 20 61 | 20 53 63 68 65 6d 65 20 |within a| Scheme |
|000044c0| 62 72 65 61 6b 70 6f 69 | 6e 74 20 65 6e 74 65 72 |breakpoi|nt enter|
|000044d0| 73 0a 61 20 72 65 61 64 | 2d 65 78 65 63 75 74 65 |s.a read|-execute|
|000044e0| 20 6c 6f 6f 70 2c 20 77 | 68 69 63 68 20 61 63 63 | loop, w|hich acc|
|000044f0| 65 70 74 73 20 73 69 6e | 67 6c 65 2d 63 68 61 72 |epts sin|gle-char|
|00004500| 61 63 74 65 72 20 63 6f | 6d 6d 61 6e 64 73 20 77 |acter co|mmands w|
|00004510| 68 69 63 68 0a 65 6e 61 | 62 6c 65 20 79 6f 75 20 |hich.ena|ble you |
|00004520| 74 6f 20 6d 6f 76 65 20 | 62 61 63 6b 77 61 72 64 |to move |backward|
|00004530| 73 20 61 6e 64 20 66 6f | 72 77 61 72 64 73 20 69 |s and fo|rwards i|
|00004540| 6e 20 74 68 65 20 68 69 | 73 74 6f 72 79 20 6f 66 |n the hi|story of|
|00004550| 20 74 68 65 0a 65 78 70 | 72 65 73 73 69 6f 6e 73 | the.exp|ressions|
|00004560| 20 77 68 69 63 68 20 68 | 61 76 65 20 62 65 65 6e | which h|ave been|
|00004570| 20 65 76 61 6c 75 61 74 | 65 64 2e 20 20 59 6f 75 | evaluat|ed. You|
|00004580| 20 63 61 6e 20 61 6c 73 | 6f 20 65 78 61 6d 69 6e | can als|o examin|
|00004590| 65 0a 70 72 6f 63 65 64 | 75 72 65 73 20 61 6e 64 |e.proced|ures and|
|000045a0| 20 76 61 72 69 61 62 6c | 65 73 20 61 74 20 74 68 | variabl|es at th|
|000045b0| 65 20 64 69 66 66 65 72 | 65 6e 74 20 65 76 61 6c |e differ|ent eval|
|000045c0| 75 61 74 69 6f 6e 20 6c | 65 76 65 6c 73 2e 20 20 |uation l|evels. |
|000045d0| 54 68 65 0a 70 72 6f 6d | 70 74 20 69 73 20 7b 5c |The.prom|pt is {\|
|000045e0| 74 74 20 44 65 62 75 67 | 7d 2e 20 20 4a 75 73 74 |tt Debug|}. Just|
|000045f0| 20 61 73 20 77 69 74 68 | 20 7b 5c 74 74 20 77 68 | as with| {\tt wh|
|00004600| 65 72 65 7d 2c 20 53 63 | 68 65 6d 65 20 70 72 6f |ere}, Sc|heme pro|
|00004610| 6d 70 74 73 20 66 6f 72 | 0a 74 68 65 20 63 6f 6d |mpts for|.the com|
|00004620| 6d 61 6e 64 73 20 69 6e | 20 74 68 65 20 6d 6f 64 |mands in| the mod|
|00004630| 65 20 6c 69 6e 65 20 61 | 74 20 74 68 65 20 62 6f |e line a|t the bo|
|00004640| 74 74 6f 6d 20 6f 66 20 | 74 68 65 20 73 63 72 65 |ttom of |the scre|
|00004650| 65 6e 2e 0a 0a 49 6e 20 | 6f 72 64 65 72 20 74 6f |en...In |order to|
|00004660| 20 6d 61 6b 65 20 67 6f | 6f 64 20 75 73 65 20 6f | make go|od use o|
|00004670| 66 20 74 68 65 20 64 65 | 62 75 67 67 65 72 2c 20 |f the de|bugger, |
|00004680| 79 6f 75 20 6d 75 73 74 | 20 75 6e 64 65 72 73 74 |you must| underst|
|00004690| 61 6e 64 20 74 68 65 0a | 63 6f 6e 63 65 70 74 20 |and the.|concept |
|000046a0| 6f 66 20 61 20 5c 64 65 | 66 69 6e 69 6e 67 7b 72 |of a \de|fining{r|
|000046b0| 65 64 75 63 74 69 6f 6e | 7d 20 61 6e 64 20 61 20 |eduction|} and a |
|000046c0| 5c 64 65 66 69 6e 69 6e | 67 7b 73 75 62 70 72 6f |\definin|g{subpro|
|000046d0| 62 6c 65 6d 7d 2e 20 20 | 54 68 65 0a 69 6e 74 65 |blem}. |The.inte|
|000046e0| 72 70 72 65 74 65 72 20 | 65 76 61 6c 75 61 74 65 |rpreter |evaluate|
|000046f0| 73 20 61 6e 20 65 78 70 | 72 65 73 73 69 6f 6e 20 |s an exp|ression |
|00004700| 62 79 20 7b 5c 65 6d 20 | 72 65 64 75 63 69 6e 67 |by {\em |reducing|
|00004710| 7d 20 69 74 20 74 6f 20 | 61 20 73 69 6d 70 6c 65 |} it to |a simple|
|00004720| 72 0a 65 78 70 72 65 73 | 73 69 6f 6e 2e 20 20 49 |r.expres|sion. I|
|00004730| 6e 20 67 65 6e 65 72 61 | 6c 2c 20 53 63 68 65 6d |n genera|l, Schem|
|00004740| 65 27 73 20 65 76 61 6c | 75 61 74 69 6f 6e 20 72 |e's eval|uation r|
|00004750| 75 6c 65 73 20 64 65 73 | 69 67 6e 61 74 65 20 74 |ules des|ignate t|
|00004760| 68 61 74 0a 65 76 61 6c | 75 61 74 69 6f 6e 20 70 |hat.eval|uation p|
|00004770| 72 6f 63 65 65 64 73 20 | 66 72 6f 6d 20 6f 6e 65 |roceeds |from one|
|00004780| 20 65 78 70 72 65 73 73 | 69 6f 6e 20 74 6f 20 74 | express|ion to t|
|00004790| 68 65 20 6e 65 78 74 20 | 62 79 20 65 69 74 68 65 |he next |by eithe|
|000047a0| 72 20 73 74 61 72 74 69 | 6e 67 0a 74 6f 20 77 6f |r starti|ng.to wo|
|000047b0| 72 6b 20 6f 6e 20 61 20 | 7b 5c 65 6d 20 73 75 62 |rk on a |{\em sub|
|000047c0| 65 78 70 72 65 73 73 69 | 6f 6e 7d 20 6f 66 20 74 |expressi|on} of t|
|000047d0| 68 65 20 67 69 76 65 6e | 20 65 78 70 72 65 73 73 |he given| express|
|000047e0| 69 6f 6e 2c 20 6f 72 20 | 62 79 20 7b 5c 65 6d 0a |ion, or |by {\em.|
|000047f0| 72 65 64 75 63 69 6e 67 | 7d 20 74 68 65 20 65 6e |reducing|} the en|
|00004800| 74 69 72 65 20 65 78 70 | 72 65 73 73 69 6f 6e 20 |tire exp|ression |
|00004810| 74 6f 20 61 20 6e 65 77 | 20 28 73 69 6d 70 6c 65 |to a new| (simple|
|00004820| 72 2c 20 6f 72 20 72 65 | 64 75 63 65 64 29 20 66 |r, or re|duced) f|
|00004830| 6f 72 6d 2e 0a 54 68 75 | 73 2c 20 61 20 68 69 73 |orm..Thu|s, a his|
|00004840| 74 6f 72 79 20 6f 66 20 | 74 68 65 20 73 75 63 63 |tory of |the succ|
|00004850| 65 73 73 69 76 65 20 66 | 6f 72 6d 73 20 70 72 6f |essive f|orms pro|
|00004860| 63 65 73 73 65 64 20 64 | 75 72 69 6e 67 20 74 68 |cessed d|uring th|
|00004870| 65 0a 65 76 61 6c 75 61 | 74 69 6f 6e 20 6f 66 20 |e.evalua|tion of |
|00004880| 61 6e 20 65 78 70 72 65 | 73 73 69 6f 6e 20 77 69 |an expre|ssion wi|
|00004890| 6c 6c 20 73 68 6f 77 20 | 61 20 73 65 71 75 65 6e |ll show |a sequen|
|000048a0| 63 65 20 6f 66 20 73 75 | 62 70 72 6f 62 6c 65 6d |ce of su|bproblem|
|000048b0| 73 2c 20 77 68 65 72 65 | 0a 65 61 63 68 20 73 75 |s, where|.each su|
|000048c0| 62 70 72 6f 62 6c 65 6d | 20 6d 61 79 20 69 6e 76 |bproblem| may inv|
|000048d0| 6f 6c 76 65 20 61 20 73 | 65 71 75 65 6e 63 65 20 |olve a s|equence |
|000048e0| 6f 66 20 72 65 64 75 63 | 74 69 6f 6e 73 2e 20 20 |of reduc|tions. |
|000048f0| 54 68 65 20 62 65 73 74 | 20 77 61 79 20 74 6f 0a |The best| way to.|
|00004900| 67 65 74 20 61 20 66 65 | 65 6c 69 6e 67 20 66 6f |get a fe|eling fo|
|00004910| 72 20 68 6f 77 20 72 65 | 64 75 63 74 69 6f 6e 73 |r how re|ductions|
|00004920| 20 61 6e 64 20 73 75 62 | 70 72 6f 62 6c 65 6d 73 | and sub|problems|
|00004930| 20 77 6f 72 6b 20 69 73 | 20 74 6f 20 77 72 69 74 | work is| to writ|
|00004940| 65 20 73 6f 6d 65 0a 74 | 65 73 74 20 65 78 70 72 |e some.t|est expr|
|00004950| 65 73 73 69 6f 6e 73 20 | 61 6e 64 20 70 6c 61 79 |essions |and play|
|00004960| 20 77 69 74 68 20 74 68 | 65 6d 20 75 73 69 6e 67 | with th|em using|
|00004970| 20 74 68 65 20 7b 5c 74 | 74 20 64 65 62 75 67 7d | the {\t|t debug}|
|00004980| 20 70 72 6f 63 65 64 75 | 72 65 2e 0a 0a 0a 48 65 | procedu|re....He|
|00004990| 72 65 20 69 73 20 61 20 | 73 75 6d 6d 61 72 79 20 |re is a |summary |
|000049a0| 6f 66 20 74 68 65 20 7b | 5c 74 74 20 64 65 62 75 |of the {|\tt debu|
|000049b0| 67 7d 20 63 6f 6d 6d 61 | 6e 64 73 2e 0a 5c 62 65 |g} comma|nds..\be|
|000049c0| 67 69 6e 7b 64 65 73 63 | 72 69 70 74 69 6f 6e 7d |gin{desc|ription}|
|000049d0| 0a 5c 69 74 65 6d 20 5b | 7b 5c 74 74 20 3f 7d 5d |.\item [|{\tt ?}]|
|000049e0| 20 50 72 69 6e 74 73 20 | 61 20 73 75 6d 6d 61 72 | Prints |a summar|
|000049f0| 79 20 6f 66 20 74 68 65 | 20 7b 5c 74 74 20 64 65 |y of the| {\tt de|
|00004a00| 62 75 67 7d 20 63 6f 6d | 6d 61 6e 64 73 2e 0a 0a |bug} com|mands...|
|00004a10| 5c 69 74 65 6d 20 5b 7b | 5c 74 74 20 42 7d 5d 20 |\item [{|\tt B}] |
|00004a20| 28 66 6f 72 20 62 61 63 | 6b 29 20 4d 6f 76 65 73 |(for bac|k) Moves|
|00004a30| 20 62 61 63 6b 20 74 6f | 20 74 68 65 20 60 60 70 | back to| the ``p|
|00004a40| 72 65 76 69 6f 75 73 20 | 65 78 70 72 65 73 73 69 |revious |expressi|
|00004a50| 6f 6e 2c 27 27 20 74 68 | 61 74 20 77 61 73 0a 62 |on,'' th|at was.b|
|00004a60| 65 69 6e 67 20 70 72 6f | 63 65 73 73 65 64 2e 20 |eing pro|cessed. |
|00004a70| 20 57 68 61 74 20 74 68 | 69 73 20 6d 65 61 6e 73 | What th|is means|
|00004a80| 20 69 73 20 61 73 20 66 | 6f 6c 6c 6f 77 73 3a 20 | is as f|ollows: |
|00004a90| 20 4f 6e 65 20 67 6f 65 | 73 20 62 61 63 6b 77 61 | One goe|s backwa|
|00004aa0| 72 64 73 0a 61 6c 6f 6e | 67 20 74 68 65 20 73 65 |rds.alon|g the se|
|00004ab0| 71 75 65 6e 63 65 20 6f | 66 20 72 65 64 75 63 74 |quence o|f reduct|
|00004ac0| 69 6f 6e 73 20 74 68 61 | 74 20 70 72 6f 64 75 63 |ions tha|t produc|
|00004ad0| 65 64 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 65 |ed the c|urrent e|
|00004ae0| 78 70 72 65 73 73 69 6f | 6e 0a 75 6e 74 69 6c 20 |xpressio|n.until |
|00004af0| 72 65 61 63 68 69 6e 67 | 20 74 68 65 20 73 75 62 |reaching| the sub|
|00004b00| 70 72 6f 62 6c 65 6d 20 | 74 68 61 74 20 6c 65 64 |problem |that led|
|00004b10| 20 74 6f 20 74 68 69 73 | 20 63 68 61 69 6e 20 6f | to this| chain o|
|00004b20| 66 20 72 65 64 75 63 74 | 69 6f 6e 73 2e 0a 54 68 |f reduct|ions..Th|
|00004b30| 65 6e 20 6f 6e 65 20 6d | 6f 76 65 73 20 60 60 75 |en one m|oves ``u|
|00004b40| 70 77 61 72 64 27 27 20 | 69 6e 20 74 68 65 20 74 |pward'' |in the t|
|00004b50| 72 65 65 20 6f 66 20 73 | 75 62 70 72 6f 62 6c 65 |ree of s|ubproble|
|00004b60| 6d 73 2c 20 75 6e 74 69 | 6c 20 72 65 61 63 68 69 |ms, unti|l reachi|
|00004b70| 6e 67 0a 74 68 65 20 65 | 78 70 72 65 73 73 69 6f |ng.the e|xpressio|
|00004b80| 6e 20 74 68 61 74 20 77 | 61 73 20 74 79 70 65 64 |n that w|as typed|
|00004b90| 20 61 74 20 74 68 65 20 | 52 45 50 20 6c 6f 6f 70 | at the |REP loop|
|00004ba0| 20 77 68 69 63 68 20 69 | 6e 69 74 69 61 74 65 64 | which i|nitiated|
|00004bb0| 20 74 68 65 0a 77 68 6f | 6c 65 20 70 72 6f 63 65 | the.who|le proce|
|00004bc0| 73 73 2e 0a 0a 5c 69 74 | 65 6d 20 5b 7b 5c 74 74 |ss...\it|em [{\tt|
|00004bd0| 20 43 7d 5d 20 28 66 6f | 72 20 63 75 72 72 65 6e | C}] (fo|r curren|
|00004be0| 74 29 20 53 68 6f 77 73 | 20 61 6c 6c 20 74 68 65 |t) Shows| all the|
|00004bf0| 20 76 61 72 69 61 62 6c | 65 20 62 69 6e 64 69 6e | variabl|e bindin|
|00004c00| 67 73 20 69 6e 20 74 68 | 65 0a 65 6e 76 69 72 6f |gs in th|e.enviro|
|00004c10| 6e 6d 65 6e 74 20 69 6e | 20 77 68 69 63 68 20 74 |nment in| which t|
|00004c20| 68 65 20 63 75 72 72 65 | 6e 74 20 73 75 62 70 72 |he curre|nt subpr|
|00004c30| 6f 62 6c 65 6d 0a 77 61 | 73 20 62 65 69 6e 67 20 |oblem.wa|s being |
|00004c40| 65 76 61 6c 75 61 74 65 | 64 2e 0a 20 20 0a 5c 69 |evaluate|d.. .\i|
|00004c50| 74 65 6d 20 5b 7b 5c 74 | 74 20 44 7d 5d 20 28 66 |tem [{\t|t D}] (f|
|00004c60| 6f 72 20 64 6f 77 6e 29 | 20 4d 6f 76 65 73 20 64 |or down)| Moves d|
|00004c70| 6f 77 6e 20 74 6f 20 61 | 20 6c 6f 77 65 72 20 73 |own to a| lower s|
|00004c80| 75 62 70 72 6f 62 6c 65 | 6d 20 6c 65 76 65 6c 2e |ubproble|m level.|
|00004c90| 20 20 54 68 69 73 0a 69 | 73 20 74 68 65 20 73 75 | This.i|s the su|
|00004ca0| 62 70 72 6f 62 6c 65 6d | 20 77 68 69 63 68 20 77 |bproblem| which w|
|00004cb0| 61 73 20 65 76 61 6c 75 | 61 74 65 64 20 61 66 74 |as evalu|ated aft|
|00004cc0| 65 72 0a 28 69 6e 20 74 | 69 6d 65 29 20 74 68 65 |er.(in t|ime) the|
|00004cd0| 20 63 75 72 72 65 6e 74 | 20 6f 6e 65 2e 0a 0a 5c | current| one...\|
|00004ce0| 69 74 65 6d 20 5b 7b 5c | 74 74 20 45 7d 5d 20 28 |item [{\|tt E}] (|
|00004cf0| 66 6f 72 20 65 76 61 6c | 29 20 45 6e 74 65 72 73 |for eval|) Enters|
|00004d00| 20 61 20 52 45 50 20 6c | 6f 6f 70 20 69 6e 20 74 | a REP l|oop in t|
|00004d10| 68 65 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 20 69 |he envir|onment i|
|00004d20| 6e 20 77 68 69 63 68 0a | 74 68 65 20 63 75 72 72 |n which.|the curr|
|00004d30| 65 6e 74 20 73 75 62 70 | 72 6f 62 6c 65 6d 20 77 |ent subp|roblem w|
|00004d40| 61 73 20 62 65 69 6e 67 | 20 65 76 61 6c 75 61 74 |as being| evaluat|
|00004d50| 65 64 2e 0a 0a 5c 69 74 | 65 6d 20 5b 7b 5c 74 74 |ed...\it|em [{\tt|
|00004d60| 20 46 7d 5d 20 28 66 6f | 72 20 66 6f 72 77 61 72 | F}] (fo|r forwar|
|00004d70| 64 29 20 4d 6f 76 65 73 | 20 74 6f 20 74 68 65 20 |d) Moves| to the |
|00004d80| 60 60 6e 65 78 74 27 27 | 20 65 78 70 72 65 73 73 |``next''| express|
|00004d90| 69 6f 6e 20 61 66 74 65 | 72 20 74 68 65 20 63 75 |ion afte|r the cu|
|00004da0| 72 72 65 6e 74 0a 6f 6e | 65 2e 20 20 54 68 65 20 |rrent.on|e. The |
|00004db0| 6f 72 64 65 72 20 69 73 | 20 28 74 68 65 20 6f 70 |order is| (the op|
|00004dc0| 70 6f 73 69 74 65 20 6f | 66 29 20 74 68 65 20 6f |posite o|f) the o|
|00004dd0| 6e 65 20 64 65 73 63 72 | 69 62 65 64 20 66 6f 72 |ne descr|ibed for|
|00004de0| 20 74 68 65 20 42 20 63 | 6f 6d 6d 61 6e 64 2e 0a | the B c|ommand..|
|00004df0| 0a 5c 69 74 65 6d 20 5b | 7b 5c 74 74 20 47 7d 5d |.\item [|{\tt G}]|
|00004e00| 20 28 66 6f 72 20 67 6f | 29 20 47 6f 65 73 20 74 | (for go|) Goes t|
|00004e10| 6f 20 61 20 70 61 72 74 | 69 63 75 6c 61 72 20 73 |o a part|icular s|
|00004e20| 75 62 70 72 6f 62 6c 65 | 6d 20 61 6e 64 20 72 65 |ubproble|m and re|
|00004e30| 64 75 63 74 69 6f 6e 0a | 6c 65 76 65 6c 2e 20 20 |duction.|level. |
|00004e40| 7b 5c 74 74 20 44 65 62 | 75 67 7d 20 61 73 6b 73 |{\tt Deb|ug} asks|
|00004e50| 20 79 6f 75 20 66 6f 72 | 20 74 68 65 20 6e 75 6d | you for| the num|
|00004e60| 62 65 72 73 2e 20 20 45 | 61 63 68 20 65 78 70 72 |bers. E|ach expr|
|00004e70| 65 73 73 69 6f 6e 20 68 | 61 73 20 74 77 6f 0a 6e |ession h|as two.n|
|00004e80| 75 6d 62 65 72 73 20 74 | 6f 20 69 6e 64 69 63 61 |umbers t|o indica|
|00004e90| 74 65 20 61 20 73 75 62 | 70 72 6f 62 6c 65 6d 20 |te a sub|problem |
|00004ea0| 61 6e 64 20 61 20 72 65 | 64 75 63 74 69 6f 6e 20 |and a re|duction |
|00004eb0| 6f 66 20 74 68 61 74 20 | 73 75 62 70 72 6f 62 6c |of that |subprobl|
|00004ec0| 65 6d 2e 0a 53 69 6d 70 | 6c 69 66 69 65 64 20 28 |em..Simp|lified (|
|00004ed0| 6d 6f 72 65 20 72 65 64 | 75 63 65 64 29 20 65 78 |more red|uced) ex|
|00004ee0| 70 72 65 73 73 69 6f 6e | 73 20 68 61 76 65 20 6c |pression|s have l|
|00004ef0| 6f 77 65 72 20 72 65 64 | 75 63 74 69 6f 6e 20 6e |ower red|uction n|
|00004f00| 75 6d 62 65 72 73 2e 0a | 4c 6f 77 65 72 20 6c 65 |umbers..|Lower le|
|00004f10| 76 65 6c 20 28 73 6d 61 | 6c 6c 65 72 20 73 75 62 |vel (sma|ller sub|
|00004f20| 70 72 6f 62 6c 65 6d 29 | 20 65 78 70 72 65 73 73 |problem)| express|
|00004f30| 69 6f 6e 73 20 68 61 76 | 65 20 6c 6f 77 65 72 20 |ions hav|e lower |
|00004f40| 73 75 62 70 72 6f 62 6c | 65 6d 20 6e 75 6d 62 65 |subprobl|em numbe|
|00004f50| 72 73 2e 0a 54 68 75 73 | 20 74 68 65 20 63 75 72 |rs..Thus| the cur|
|00004f60| 72 65 6e 74 20 65 72 72 | 6f 72 20 65 78 70 72 65 |rent err|or expre|
|00004f70| 73 73 69 6f 6e 20 69 73 | 20 6e 75 6d 62 65 72 65 |ssion is| numbere|
|00004f80| 64 20 24 28 30 2c 30 29 | 24 2e 0a 0a 5c 69 74 65 |d $(0,0)|$...\ite|
|00004f90| 6d 20 5b 7b 5c 74 74 20 | 48 7d 5d 20 28 66 6f 72 |m [{\tt |H}] (for|
|00004fa0| 20 68 69 73 74 6f 72 79 | 29 20 50 72 69 6e 74 73 | history|) Prints|
|00004fb0| 20 61 20 73 75 6d 6d 61 | 72 79 20 6f 66 20 74 68 | a summa|ry of th|
|00004fc0| 65 20 65 6e 74 69 72 65 | 20 68 69 73 74 6f 72 79 |e entire| history|
|00004fd0| 2e 0a 54 68 69 73 20 69 | 73 20 6c 69 6b 65 20 74 |..This i|s like t|
|00004fe0| 79 70 69 6e 67 20 42 20 | 72 65 70 65 61 74 65 64 |yping B |repeated|
|00004ff0| 6c 79 2e 0a 0a 5c 69 74 | 65 6d 20 5b 7b 5c 74 74 |ly...\it|em [{\tt|
|00005000| 20 49 7d 5d 20 28 66 6f | 72 20 69 6e 66 6f 72 6d | I}] (fo|r inform|
|00005010| 61 74 69 6f 6e 29 20 52 | 65 64 69 73 70 6c 61 79 |ation) R|edisplay|
|00005020| 73 20 74 68 65 20 65 72 | 72 6f 72 20 6d 65 73 73 |s the er|ror mess|
|00005030| 61 67 65 2e 0a 0a 5c 69 | 74 65 6d 20 5b 7b 5c 74 |age...\i|tem [{\t|
|00005040| 74 20 4c 7d 5d 20 28 66 | 6f 72 20 6c 69 73 74 20 |t L}] (f|or list |
|00005050| 63 75 72 72 65 6e 74 20 | 65 78 70 72 65 73 73 69 |current |expressi|
|00005060| 6f 6e 29 20 50 72 65 74 | 74 79 2d 70 72 69 6e 74 |on) Pret|ty-print|
|00005070| 73 20 74 68 65 0a 63 75 | 72 72 65 6e 74 20 65 78 |s the.cu|rrent ex|
|00005080| 70 72 65 73 73 69 6f 6e | 2e 0a 0a 5c 69 74 65 6d |pression|...\item|
|00005090| 20 5b 7b 5c 74 74 20 50 | 7d 5d 20 28 66 6f 72 20 | [{\tt P|}] (for |
|000050a0| 70 72 6f 63 65 64 75 72 | 65 29 20 50 72 65 74 74 |procedur|e) Prett|
|000050b0| 79 2d 70 72 69 6e 74 73 | 20 63 75 72 72 65 6e 74 |y-prints| current|
|000050c0| 20 70 72 6f 63 65 64 75 | 72 65 2e 0a 0a 5c 69 74 | procedu|re...\it|
|000050d0| 65 6d 20 5b 7b 5c 74 74 | 20 51 7d 5d 20 28 66 6f |em [{\tt| Q}] (fo|
|000050e0| 72 20 71 75 69 74 29 20 | 45 78 69 74 73 20 7b 5c |r quit) |Exits {\|
|000050f0| 74 74 20 64 65 62 75 67 | 7d 20 72 65 74 75 72 6e |tt debug|} return|
|00005100| 69 6e 67 20 74 6f 20 74 | 68 65 20 65 6e 76 69 72 |ing to t|he envir|
|00005110| 6f 6e 6d 65 6e 74 20 69 | 6e 0a 77 68 69 63 68 20 |onment i|n.which |
|00005120| 74 68 65 20 65 72 72 6f | 72 20 6f 63 63 75 72 72 |the erro|r occurr|
|00005130| 65 64 2c 20 61 6e 64 20 | 61 74 20 74 68 65 20 65 |ed, and |at the e|
|00005140| 78 70 72 65 73 73 69 6f | 6e 20 77 68 69 63 68 20 |xpressio|n which |
|00005150| 63 61 75 73 65 64 20 74 | 68 65 0a 65 72 72 6f 72 |caused t|he.error|
|00005160| 2e 0a 0a 5c 69 74 65 6d | 20 5b 7b 5c 74 74 20 52 |...\item| [{\tt R|
|00005170| 7d 5d 20 28 66 6f 72 20 | 72 65 64 75 63 74 69 6f |}] (for |reductio|
|00005180| 6e 73 29 20 50 72 69 6e | 74 73 20 61 6c 6c 20 74 |ns) Prin|ts all t|
|00005190| 68 65 20 72 65 64 75 63 | 74 69 6f 6e 73 20 6f 66 |he reduc|tions of|
|000051a0| 20 74 68 65 20 63 75 72 | 72 65 6e 74 0a 73 75 62 | the cur|rent.sub|
|000051b0| 70 72 6f 62 6c 65 6d 20 | 20 6c 65 76 65 6c 2e 0a |problem | level..|
|000051c0| 0a 5c 69 74 65 6d 20 5b | 7b 5c 74 74 20 53 7d 5d |.\item [|{\tt S}]|
|000051d0| 20 28 66 6f 72 20 73 75 | 62 70 72 6f 62 6c 65 6d | (for su|bproblem|
|000051e0| 29 20 50 72 69 6e 74 73 | 20 74 68 65 20 63 75 72 |) Prints| the cur|
|000051f0| 72 65 6e 74 20 73 75 62 | 70 72 6f 62 6c 65 6d 20 |rent sub|problem |
|00005200| 61 6e 64 20 72 65 64 75 | 63 74 69 6f 6e 0a 73 68 |and redu|ction.sh|
|00005210| 6f 77 69 6e 67 20 77 68 | 65 72 65 20 69 6e 20 74 |owing wh|ere in t|
|00005220| 68 65 20 65 76 61 6c 75 | 61 74 69 6f 6e 20 68 69 |he evalu|ation hi|
|00005230| 73 74 6f 72 79 20 74 68 | 65 0a 75 73 65 72 20 69 |story th|e.user i|
|00005240| 73 2e 0a 0a 5c 69 74 65 | 6d 20 5b 7b 5c 74 74 20 |s...\ite|m [{\tt |
|00005250| 55 7d 5d 20 28 66 6f 72 | 20 75 70 29 20 4d 6f 76 |U}] (for| up) Mov|
|00005260| 65 73 20 75 70 20 74 6f | 20 74 68 65 20 70 72 65 |es up to| the pre|
|00005270| 76 69 6f 75 73 20 73 75 | 62 70 72 6f 62 6c 65 6d |vious su|bproblem|
|00005280| 20 6c 65 76 65 6c 2e 0a | 54 68 69 73 20 69 73 20 | level..|This is |
|00005290| 61 20 73 75 62 70 72 6f | 62 6c 65 6d 20 77 68 69 |a subpro|blem whi|
|000052a0| 63 68 20 69 6e 63 6c 75 | 64 65 73 20 61 73 20 6f |ch inclu|des as o|
|000052b0| 6e 65 20 6f 66 0a 69 74 | 73 20 70 61 72 74 73 20 |ne of.it|s parts |
|000052c0| 74 68 65 20 63 75 72 72 | 65 6e 74 20 73 75 62 70 |the curr|ent subp|
|000052d0| 72 6f 62 6c 65 6d 2e 20 | 20 49 74 20 68 61 73 20 |roblem. | It has |
|000052e0| 61 0a 68 69 67 68 65 72 | 20 73 75 62 70 72 6f 62 |a.higher| subprob|
|000052f0| 6c 65 6d 20 6e 75 6d 62 | 65 72 2e 0a 0a 5c 69 74 |lem numb|er...\it|
|00005300| 65 6d 20 5b 7b 5c 74 74 | 20 56 7d 5d 20 28 66 6f |em [{\tt| V}] (fo|
|00005310| 72 20 76 61 6c 75 65 29 | 20 41 73 6b 73 20 66 6f |r value)| Asks fo|
|00005320| 72 20 61 6e 20 65 78 70 | 72 65 73 73 69 6f 6e 20 |r an exp|ression |
|00005330| 61 6e 64 20 65 76 61 6c | 75 61 74 65 73 20 69 74 |and eval|uates it|
|00005340| 20 69 6e 0a 74 68 65 20 | 65 6e 76 69 72 6f 6e 6d | in.the |environm|
|00005350| 65 6e 74 20 69 6e 20 77 | 68 69 63 68 20 74 68 65 |ent in w|hich the|
|00005360| 20 63 75 72 72 65 6e 74 | 0a 73 75 62 70 72 6f 62 | current|.subprob|
|00005370| 6c 65 6d 20 77 61 73 20 | 62 65 69 6e 67 20 65 76 |lem was |being ev|
|00005380| 61 6c 75 61 74 65 64 2e | 0a 0a 5c 69 74 65 6d 20 |aluated.|..\item |
|00005390| 5b 7b 5c 74 74 20 57 7d | 5d 20 28 66 6f 72 20 77 |[{\tt W}|] (for w|
|000053a0| 68 65 72 65 29 20 45 6e | 74 65 72 73 20 7b 5c 74 |here) En|ters {\t|
|000053b0| 74 20 77 68 65 72 65 7d | 20 6f 6e 20 74 68 65 20 |t where}| on the |
|000053c0| 63 75 72 72 65 6e 74 20 | 65 6e 76 69 72 6f 6e 6d |current |environm|
|000053d0| 65 6e 74 0a 0a 5c 69 74 | 65 6d 20 5b 7b 5c 74 74 |ent..\it|em [{\tt|
|000053e0| 20 5a 7d 5d 20 28 66 6f | 72 20 7a 61 70 29 20 41 | Z}] (fo|r zap) A|
|000053f0| 73 6b 73 20 66 6f 72 20 | 61 6e 20 65 78 70 72 65 |sks for |an expre|
|00005400| 73 73 69 6f 6e 20 61 6e | 64 20 65 76 61 6c 75 61 |ssion an|d evalua|
|00005410| 74 65 73 20 69 74 20 69 | 6e 0a 74 68 65 20 63 75 |tes it i|n.the cu|
|00005420| 72 72 65 6e 74 20 65 6e | 76 69 72 6f 6e 6d 65 6e |rrent en|vironmen|
|00005430| 74 2e 20 20 54 68 65 20 | 76 61 6c 75 65 20 6f 66 |t. The |value of|
|00005440| 20 74 68 65 0a 65 78 70 | 72 65 73 73 69 6f 6e 20 | the.exp|ression |
|00005450| 69 73 20 75 73 65 64 20 | 69 6e 20 70 6c 61 63 65 |is used |in place|
|00005460| 20 6f 66 20 74 68 65 20 | 76 61 6c 75 65 20 74 68 | of the |value th|
|00005470| 65 0a 63 75 72 72 65 6e | 74 20 73 75 62 70 72 6f |e.curren|t subpro|
|00005480| 62 6c 65 6d 20 77 6f 75 | 6c 64 20 68 61 76 65 20 |blem wou|ld have |
|00005490| 72 65 74 75 72 6e 65 64 | 2c 20 61 6e 64 0a 65 78 |returned|, and.ex|
|000054a0| 65 63 75 74 69 6f 6e 20 | 69 73 20 72 65 73 75 6d |ecution |is resum|
|000054b0| 65 64 20 66 72 6f 6d 20 | 74 68 69 73 20 70 6f 69 |ed from |this poi|
|000054c0| 6e 74 20 69 6e 20 74 68 | 65 0a 6f 72 69 67 69 6e |nt in th|e.origin|
|000054d0| 61 6c 20 65 76 61 6c 75 | 61 74 69 6f 6e 2e 0a 5c |al evalu|ation..\|
|000054e0| 65 6e 64 7b 64 65 73 63 | 72 69 70 74 69 6f 6e 7d |end{desc|ription}|
|000054f0| 0a 0a 46 6f 72 20 61 20 | 66 69 72 73 74 20 6c 6f |..For a |first lo|
|00005500| 6f 6b 20 61 74 20 74 68 | 65 20 64 65 62 75 67 67 |ok at th|e debugg|
|00005510| 65 72 20 77 65 20 77 69 | 6c 6c 20 75 73 65 20 73 |er we wi|ll use s|
|00005520| 65 76 65 72 61 6c 20 6f | 66 20 74 68 65 0a 63 6f |everal o|f the.co|
|00005530| 6d 6d 6f 6e 20 63 6f 6d | 6d 61 6e 64 73 20 6a 75 |mmon com|mands ju|
|00005540| 73 74 20 74 6f 20 73 65 | 65 20 68 6f 77 20 74 68 |st to se|e how th|
|00005550| 65 79 20 77 6f 72 6b 2e | 20 20 48 65 72 65 20 69 |ey work.| Here i|
|00005560| 73 20 61 20 64 65 6d 6f | 6e 73 74 72 61 74 69 6f |s a demo|nstratio|
|00005570| 6e 2e 0a 5c 62 65 67 69 | 6e 7b 73 63 68 65 6d 65 |n..\begi|n{scheme|
|00005580| 7d 0a 20 5b 31 20 52 45 | 50 5d 20 28 64 65 66 69 |}. [1 RE|P] (defi|
|00005590| 6e 65 20 28 66 61 63 74 | 20 6e 29 0a 20 20 20 20 |ne (fact| n). |
|000055a0| 20 20 20 20 20 20 20 28 | 69 66 20 28 7a 65 72 6f | (|if (zero|
|000055b0| 3f 20 6e 29 0a 20 20 20 | 20 20 20 20 20 20 20 20 |? n). | |
|000055c0| 20 20 20 20 6c 0a 20 20 | 20 20 20 20 20 20 20 20 | l. | |
|000055d0| 20 20 20 20 20 28 2a 20 | 6e 20 28 66 61 63 74 20 | (* |n (fact |
|000055e0| 28 2d 31 2b 20 6e 29 29 | 29 29 29 0a 20 46 41 43 |(-1+ n))|))). FAC|
|000055f0| 54 20 0a 20 20 20 20 20 | 0a 20 5b 31 20 52 45 50 |T . |. [1 REP|
|00005600| 5d 20 28 66 61 63 74 20 | 33 29 0a 20 55 6e 62 6f |] (fact |3). Unbo|
|00005610| 75 6e 64 20 56 61 72 69 | 61 62 6c 65 20 4c 0a 20 |und Vari|able L. |
|00005620| 45 72 72 6f 72 21 0a 20 | 20 20 20 20 0a 20 5b 32 |Error!. | . [2|
|00005630| 20 45 72 72 6f 72 5d 20 | 28 64 65 62 75 67 29 0a | Error] |(debug).|
|00005640| 20 53 75 62 70 72 6f 62 | 6c 65 6d 20 4c 65 76 65 | Subprob|lem Leve|
|00005650| 6c 3a 20 30 20 20 52 65 | 64 75 63 74 69 6f 6e 20 |l: 0 Re|duction |
|00005660| 4e 75 6d 62 65 72 3a 20 | 30 0a 20 45 78 70 72 65 |Number: |0. Expre|
|00005670| 73 73 69 6f 6e 3a 0a 20 | 4c 20 0a 20 77 69 74 68 |ssion:. |L . with|
|00005680| 69 6e 20 74 68 65 20 70 | 72 6f 63 65 64 75 72 65 |in the p|rocedure|
|00005690| 20 46 41 43 54 2e 0a 20 | 61 70 70 6c 69 65 64 20 | FACT.. |applied |
|000056a0| 74 6f 20 28 30 29 0a 0a | 20 5b 33 20 44 65 62 75 |to (0)..| [3 Debu|
|000056b0| 67 5d 0a 5c 65 6e 64 7b | 73 63 68 65 6d 65 7d 0a |g].\end{|scheme}.|
|000056c0| 0a 54 68 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |.The app|lication|
|000056d0| 20 6f 66 20 74 68 65 20 | 70 72 6f 63 65 64 75 72 | of the |procedur|
|000056e0| 65 20 7b 5c 74 74 20 66 | 61 63 74 7d 20 63 61 75 |e {\tt f|act} cau|
|000056f0| 73 65 64 20 61 6e 20 65 | 72 72 6f 72 2e 20 20 57 |sed an e|rror. W|
|00005700| 65 0a 74 68 65 6e 20 63 | 61 6c 6c 65 64 20 74 68 |e.then c|alled th|
|00005710| 65 20 64 65 62 75 67 67 | 65 72 2c 20 77 68 69 63 |e debugg|er, whic|
|00005720| 68 20 70 72 69 6e 74 65 | 64 20 74 68 65 20 65 78 |h printe|d the ex|
|00005730| 70 72 65 73 73 69 6f 6e | 20 77 68 6f 73 65 0a 65 |pression| whose.e|
|00005740| 76 61 6c 75 61 74 69 6f | 6e 20 63 61 75 73 65 64 |valuatio|n caused|
|00005750| 20 74 68 65 20 65 72 72 | 6f 72 20 74 6f 20 6f 63 | the err|or to oc|
|00005760| 63 75 72 2e 20 20 54 68 | 65 20 60 60 53 75 62 70 |cur. Th|e ``Subp|
|00005770| 72 6f 62 6c 65 6d 20 4c | 65 76 65 6c 27 27 20 61 |roblem L|evel'' a|
|00005780| 6e 64 0a 74 68 65 20 60 | 60 52 65 64 75 63 74 69 |nd.the `|`Reducti|
|00005790| 6f 6e 20 4e 75 6d 62 65 | 72 27 27 20 61 72 65 20 |on Numbe|r'' are |
|000057a0| 77 61 79 73 20 6f 66 20 | 6e 75 6d 62 65 72 69 6e |ways of |numberin|
|000057b0| 67 20 65 78 70 72 65 73 | 73 69 6f 6e 73 20 69 6e |g expres|sions in|
|000057c0| 20 74 68 65 0a 68 69 73 | 74 6f 72 79 2e 20 20 54 | the.his|tory. T|
|000057d0| 68 65 20 70 72 6f 63 65 | 64 75 72 65 20 77 68 6f |he proce|dure who|
|000057e0| 73 65 20 62 6f 64 79 20 | 69 73 20 63 75 72 72 65 |se body |is curre|
|000057f0| 6e 74 6c 79 20 62 65 69 | 6e 67 20 65 76 61 6c 75 |ntly bei|ng evalu|
|00005800| 61 74 65 64 2c 20 61 73 | 0a 77 65 6c 6c 20 61 73 |ated, as|.well as|
|00005810| 20 74 68 65 20 61 72 67 | 75 6d 65 6e 74 73 20 70 | the arg|uments p|
|00005820| 61 73 73 65 64 20 74 6f | 20 69 74 20 61 72 65 20 |assed to| it are |
|00005830| 64 69 73 70 6c 61 79 65 | 64 2e 20 20 54 68 65 20 |displaye|d. The |
|00005840| 64 65 62 75 67 67 65 72 | 0a 61 63 63 65 70 74 73 |debugger|.accepts|
|00005850| 20 6f 6e 65 20 6c 65 74 | 74 65 72 20 63 6f 6d 6d | one let|ter comm|
|00005860| 61 6e 64 73 20 77 68 69 | 63 68 20 63 61 6e 20 62 |ands whi|ch can b|
|00005870| 65 20 6c 69 73 74 65 64 | 20 62 79 20 74 79 70 69 |e listed| by typi|
|00005880| 6e 67 20 7b 5c 74 74 20 | 3f 7d 2e 0a 0a 54 68 65 |ng {\tt |?}...The|
|00005890| 20 66 61 63 74 6f 72 69 | 61 6c 20 70 72 6f 62 6c | factori|al probl|
|000058a0| 65 6d 20 61 62 6f 76 65 | 20 68 61 73 20 61 20 73 |em above| has a s|
|000058b0| 69 6d 70 6c 65 20 74 79 | 70 6f 3b 20 74 68 65 20 |imple ty|po; the |
|000058c0| 6c 65 74 74 65 72 20 7b | 5c 74 74 20 4c 7d 0a 69 |letter {|\tt L}.i|
|000058d0| 73 20 75 73 65 64 20 69 | 6e 73 74 65 61 64 20 6f |s used i|nstead o|
|000058e0| 66 20 74 68 65 20 6e 75 | 6d 62 65 72 20 31 20 69 |f the nu|mber 1 i|
|000058f0| 6e 20 74 68 65 20 7b 5c | 74 74 20 69 66 7d 20 66 |n the {\|tt if} f|
|00005900| 6f 72 6d 2c 20 72 65 73 | 75 6c 74 69 6e 67 20 69 |orm, res|ulting i|
|00005910| 6e 20 61 6e 0a 7b 5c 74 | 74 20 75 6e 62 6f 75 6e |n an.{\t|t unboun|
|00005920| 64 20 76 61 72 69 61 62 | 6c 65 7d 20 65 72 72 6f |d variab|le} erro|
|00005930| 72 2e 20 20 54 68 65 20 | 64 65 62 75 67 67 65 72 |r. The |debugger|
|00005940| 20 69 6e 64 69 63 61 74 | 65 73 20 74 68 61 74 20 | indicat|es that |
|00005950| 74 68 65 20 65 72 72 6f | 72 0a 6f 63 63 75 72 72 |the erro|r.occurr|
|00005960| 65 64 20 77 68 65 6e 20 | 7b 5c 74 74 20 66 61 63 |ed when |{\tt fac|
|00005970| 74 7d 20 77 61 73 20 63 | 61 6c 6c 65 64 20 77 69 |t} was c|alled wi|
|00005980| 74 68 20 30 20 61 73 20 | 69 74 73 20 61 72 67 75 |th 0 as |its argu|
|00005990| 6d 65 6e 74 2e 0a 0a 41 | 6c 74 68 6f 75 67 68 20 |ment...A|lthough |
|000059a0| 74 68 65 20 62 75 67 20 | 69 6e 20 74 68 69 73 20 |the bug |in this |
|000059b0| 63 61 73 65 20 69 73 20 | 65 61 73 79 20 74 6f 20 |case is |easy to |
|000059c0| 73 70 6f 74 2c 20 77 65 | 20 63 61 6e 20 6c 6f 6f |spot, we| can loo|
|000059d0| 6b 20 74 68 72 6f 75 67 | 68 0a 74 68 65 20 65 76 |k throug|h.the ev|
|000059e0| 61 6c 75 61 74 69 6f 6e | 20 68 69 73 74 6f 72 79 |aluation| history|
|000059f0| 2c 20 74 6f 20 73 65 65 | 20 68 6f 77 20 74 68 65 |, to see| how the|
|00005a00| 20 65 76 61 6c 75 61 74 | 69 6f 6e 20 70 72 6f 63 | evaluat|ion proc|
|00005a10| 65 65 64 73 2e 20 20 54 | 68 65 0a 63 6f 6d 6d 61 |eeds. T|he.comma|
|00005a20| 6e 64 20 7b 5c 74 74 20 | 48 7d 20 6c 69 73 74 73 |nd {\tt |H} lists|
|00005a30| 20 61 20 73 75 6d 6d 61 | 72 79 20 6f 66 20 74 68 | a summa|ry of th|
|00005a40| 65 20 68 69 73 74 6f 72 | 79 2e 0a 0a 5c 62 65 67 |e histor|y...\beg|
|00005a50| 69 6e 7b 73 63 68 65 6d | 65 7d 0a 0a 20 5b 33 20 |in{schem|e}.. [3 |
|00005a60| 44 65 62 75 67 5d 20 68 | 0a 20 53 75 62 20 50 72 |Debug] h|. Sub Pr|
|00005a70| 62 2e 20 50 72 6f 63 65 | 64 75 72 65 20 4e 61 6d |b. Proce|dure Nam|
|00005a80| 65 20 20 20 20 45 78 70 | 72 65 73 73 69 6f 6e 0a |e Exp|ression.|
|00005a90| 0a 20 30 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. 0 | |
|00005aa0| 20 20 20 20 20 46 41 43 | 54 20 20 20 20 4c 0a 20 | FAC|T L. |
|00005ab0| 30 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |0 | |
|00005ac0| 20 20 20 46 41 43 54 20 | 20 20 20 28 49 46 20 28 | FACT | (IF (|
|00005ad0| 5a 45 52 4f 3f 20 4e 29 | 20 4c 20 28 2a 20 4e 20 |ZERO? N)| L (* N |
|00005ae0| 28 46 41 43 54 20 28 2d | 31 2b 20 4e 29 29 29 29 |(FACT (-|1+ N))))|
|00005af0| 0a 20 30 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. 0 | |
|00005b00| 20 20 20 20 20 46 41 43 | 54 20 20 20 20 28 46 41 | FAC|T (FA|
|00005b10| 43 54 20 28 2d 31 2b 20 | 4e 29 29 0a 20 31 20 20 |CT (-1+ |N)). 1 |
|00005b20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005b30| 46 41 43 54 20 20 20 20 | 28 2a 20 4e 20 28 46 41 |FACT |(* N (FA|
|00005b40| 43 54 20 28 2d 31 2b 20 | 4e 29 29 29 0a 20 32 20 |CT (-1+ |N))). 2 |
|00005b50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005b60| 20 46 41 43 54 20 20 20 | 20 28 2a 20 4e 20 28 46 | FACT | (* N (F|
|00005b70| 41 43 54 20 28 2d 31 2b | 20 4e 29 29 29 0a 20 33 |ACT (-1+| N))). 3|
|00005b80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005b90| 20 20 46 41 43 54 20 20 | 20 20 28 2a 20 4e 20 28 | FACT | (* N (|
|00005ba0| 46 41 43 54 20 28 2d 31 | 2b 20 4e 29 29 29 0a 20 |FACT (-1|+ N))). |
|00005bb0| 34 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |4 | |
|00005bc0| 20 20 20 20 20 20 20 20 | 20 20 20 28 50 52 49 4e | | (PRIN|
|00005bd0| 54 20 28 53 43 4f 44 45 | 2d 45 56 41 4c 20 53 43 |T (SCODE|-EVAL SC|
|00005be0| 4f 44 45 20 55 53 45 52 | 2d 43 55 52 52 45 4e 54 |ODE USER|-CURRENT|
|00005bf0| 2d 45 4e 56 49 20 2e 2e | 2e 20 0a 20 35 20 20 20 |-ENVI ..|. . 5 |
|00005c00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005c10| 20 20 20 20 20 20 20 28 | 53 45 51 55 45 4e 43 45 | (|SEQUENCE|
|00005c20| 20 28 53 45 54 55 50 2d | 48 49 53 54 4f 52 59 21 | (SETUP-|HISTORY!|
|00005c30| 20 4d 41 58 2d 53 55 42 | 50 52 4f 42 4c 45 4d 53 | MAX-SUB|PROBLEMS|
|00005c40| 20 20 2e 2e 2e 0a 20 36 | 20 20 20 20 20 20 20 20 | .... 6| |
|00005c50| 20 20 20 20 20 20 20 20 | 20 20 4c 4f 4f 50 20 20 | | LOOP |
|00005c60| 20 20 28 4c 4f 4f 50 20 | 28 43 41 54 43 48 20 28 | (LOOP |(CATCH (|
|00005c70| 4c 41 4d 42 44 41 20 28 | 41 47 41 49 4e 29 20 28 |LAMBDA (|AGAIN) (|
|00005c80| 46 4c 55 49 44 2d 4c 45 | 54 20 28 28 20 2e 2e 2e |FLUID-LE|T (( ...|
|00005c90| 0a 20 37 20 20 20 20 20 | 20 20 20 20 20 20 44 52 |. 7 | DR|
|00005ca0| 49 56 45 52 2d 4c 4f 4f | 50 20 20 20 20 28 44 52 |IVER-LOO|P (DR|
|00005cb0| 49 56 45 52 2d 4c 4f 4f | 50 20 28 43 41 54 43 48 |IVER-LOO|P (CATCH|
|00005cc0| 20 28 4c 41 4d 42 44 41 | 20 28 51 55 49 54 29 20 | (LAMBDA| (QUIT) |
|00005cd0| 28 53 45 54 21 20 54 20 | 2e 2e 2e 0a 20 38 20 20 |(SET! T |.... 8 |
|00005ce0| 53 54 41 52 54 55 50 2d | 54 4f 50 2d 4c 45 56 45 |STARTUP-|TOP-LEVE|
|00005cf0| 4c 2d 44 52 2e 2e 2e 20 | 28 53 45 51 55 45 4e 43 |L-DR... |(SEQUENC|
|00005d00| 45 20 28 43 41 54 43 48 | 20 28 4c 41 4d 42 44 41 |E (CATCH| (LAMBDA|
|00005d10| 20 28 43 4f 4e 54 29 20 | 28 53 45 54 21 20 54 4f | (CONT) |(SET! TO|
|00005d20| 50 2d 20 2e 2e 2e 0a 0a | 20 5b 33 20 44 65 62 75 |P- .....| [3 Debu|
|00005d30| 67 5d 0a 51 75 69 74 21 | 20 4c 65 76 65 6c 3a 20 |g].Quit!| Level: |
|00005d40| 31 0a 5c 65 6e 64 7b 73 | 63 68 65 6d 65 7d 0a 4c |1.\end{s|cheme}.L|
|00005d50| 69 6e 65 73 20 34 20 74 | 68 72 6f 75 67 68 20 38 |ines 4 t|hrough 8|
|00005d60| 20 70 72 69 6e 74 65 64 | 20 62 79 20 74 68 65 20 | printed| by the |
|00005d70| 65 78 61 6d 69 6e 65 72 | 20 61 72 65 20 70 69 65 |examiner| are pie|
|00005d80| 63 65 73 20 6f 66 20 74 | 68 65 20 53 63 68 65 6d |ces of t|he Schem|
|00005d90| 65 20 52 45 50 0a 6c 6f | 6f 70 20 69 6d 70 6c 65 |e REP.lo|op imple|
|00005da0| 6d 65 6e 74 61 74 69 6f | 6e 20 69 74 73 65 6c 66 |mentatio|n itself|
|00005db0| 2c 20 61 6e 64 20 73 68 | 6f 75 6c 64 20 62 65 20 |, and sh|ould be |
|00005dc0| 69 67 6e 6f 72 65 64 2e | 0a 0a 54 68 65 20 6d 6f |ignored.|..The mo|
|00005dd0| 73 74 20 63 6f 6d 6d 6f | 6e 20 65 72 72 6f 72 20 |st commo|n error |
|00005de0| 74 68 61 74 20 63 61 6e | 20 62 65 20 63 6f 72 72 |that can| be corr|
|00005df0| 65 63 74 65 64 20 65 61 | 73 69 6c 79 20 66 72 6f |ected ea|sily fro|
|00005e00| 6d 20 74 68 65 20 64 65 | 62 75 67 67 65 72 0a 69 |m the de|bugger.i|
|00005e10| 73 20 61 6e 20 7b 5c 74 | 74 20 75 6e 62 6f 75 6e |s an {\t|t unboun|
|00005e20| 64 20 76 61 72 69 61 62 | 6c 65 7d 20 65 72 72 6f |d variab|le} erro|
|00005e30| 72 2e 20 20 49 6e 20 74 | 68 69 73 20 63 61 73 65 |r. In t|his case|
|00005e40| 2c 20 74 68 65 72 65 20 | 61 72 65 20 74 77 6f 0a |, there |are two.|
|00005e50| 70 6f 73 73 69 62 69 6c | 69 74 69 65 73 2e 20 20 |possibil|ities. |
|00005e60| 49 66 20 79 6f 75 20 66 | 6f 72 67 6f 74 20 74 6f |If you f|orgot to|
|00005e70| 20 64 65 66 69 6e 65 20 | 74 68 65 20 76 61 72 69 | define |the vari|
|00005e80| 61 62 6c 65 20 79 6f 75 | 20 63 61 6e 20 75 73 65 |able you| can use|
|00005e90| 20 74 68 65 0a 7b 5c 74 | 74 20 42 7d 20 63 6f 6d | the.{\t|t B} com|
|00005ea0| 6d 61 6e 64 20 74 6f 20 | 73 65 61 72 63 68 20 62 |mand to |search b|
|00005eb0| 61 63 6b 20 74 68 72 6f | 75 67 68 20 74 68 65 20 |ack thro|ugh the |
|00005ec0| 68 69 73 74 6f 72 79 20 | 75 6e 74 69 6c 20 79 6f |history |until yo|
|00005ed0| 75 20 66 69 6e 64 20 74 | 68 65 0a 70 6c 61 63 65 |u find t|he.place|
|00005ee0| 20 77 68 65 72 65 20 74 | 68 65 20 76 61 72 69 61 | where t|he varia|
|00005ef0| 62 6c 65 20 73 68 6f 75 | 6c 64 20 68 61 76 65 20 |ble shou|ld have |
|00005f00| 62 65 65 6e 20 64 65 66 | 69 6e 65 64 2e 20 20 54 |been def|ined. T|
|00005f10| 68 65 6e 2c 20 75 73 65 | 20 74 68 65 20 7b 5c 74 |hen, use| the {\t|
|00005f20| 74 0a 45 7d 20 63 6f 6d | 6d 61 6e 64 20 74 6f 20 |t.E} com|mand to |
|00005f30| 65 6e 74 65 72 20 61 20 | 52 45 50 20 6c 6f 6f 70 |enter a |REP loop|
|00005f40| 2c 20 61 6e 64 20 64 65 | 66 69 6e 65 20 74 68 65 |, and de|fine the|
|00005f50| 20 76 61 72 69 61 62 6c | 65 2e 0a 0a 5c 73 65 63 | variabl|e...\sec|
|00005f60| 74 69 6f 6e 7b 41 6e 20 | 45 78 74 65 6e 64 65 64 |tion{An |Extended|
|00005f70| 20 44 65 62 75 67 67 69 | 6e 67 20 53 65 73 73 69 | Debuggi|ng Sessi|
|00005f80| 6f 6e 7d 0a 0a 54 68 69 | 73 20 73 65 63 74 69 6f |on}..Thi|s sectio|
|00005f90| 6e 20 69 6c 6c 75 73 74 | 72 61 74 65 73 20 75 73 |n illust|rates us|
|00005fa0| 65 20 6f 66 20 74 68 65 | 20 53 63 68 65 6d 65 20 |e of the| Scheme |
|00005fb0| 5c 69 64 65 7b 64 65 62 | 75 67 7d 20 70 72 6f 63 |\ide{deb|ug} proc|
|00005fc0| 65 64 75 72 65 20 69 6e | 20 61 6e 0a 65 78 74 65 |edure in| an.exte|
|00005fd0| 6e 64 65 64 20 73 65 73 | 73 69 6f 6e 2e 20 20 54 |nded ses|sion. T|
|00005fe0| 68 65 20 66 69 72 73 74 | 20 65 78 61 6d 70 6c 65 |he first| example|
|00005ff0| 20 69 73 20 74 68 65 20 | 62 75 67 67 79 20 7b 5c | is the |buggy {\|
|00006000| 74 74 20 66 61 63 74 7d | 20 70 72 6f 63 65 64 75 |tt fact}| procedu|
|00006010| 72 65 0a 74 68 61 74 20 | 77 61 73 20 75 73 65 64 |re.that |was used|
|00006020| 20 61 73 20 61 6e 20 65 | 78 61 6d 70 6c 65 20 69 | as an e|xample i|
|00006030| 6e 20 73 65 63 74 69 6f | 6e 7e 5c 72 65 66 7b 64 |n sectio|n~\ref{d|
|00006040| 65 62 75 67 73 65 63 74 | 69 6f 6e 7d 20 61 62 6f |ebugsect|ion} abo|
|00006050| 76 65 2e 20 20 54 68 65 | 0a 73 65 71 75 65 6e 63 |ve. The|.sequenc|
|00006060| 65 20 62 65 67 69 6e 73 | 20 77 69 74 68 20 74 68 |e begins| with th|
|00006070| 65 20 69 6e 74 65 72 61 | 63 74 69 6f 6e 20 61 6c |e intera|ction al|
|00006080| 72 65 61 64 79 20 64 65 | 73 63 72 69 62 65 64 20 |ready de|scribed |
|00006090| 69 6e 0a 73 65 63 74 69 | 6f 6e 7e 5c 72 65 66 7b |in.secti|on~\ref{|
|000060a0| 64 65 62 75 67 73 65 63 | 74 69 6f 6e 7d 2e 0a 0a |debugsec|tion}...|
|000060b0| 5c 62 65 67 69 6e 7b 73 | 63 68 65 6d 65 7d 0a 20 |\begin{s|cheme}. |
|000060c0| 20 20 20 20 0a 20 5b 31 | 20 52 45 50 5d 20 28 64 | . [1| REP] (d|
|000060d0| 65 66 69 6e 65 20 28 66 | 61 63 74 20 6e 29 0a 20 |efine (f|act n). |
|000060e0| 20 20 20 20 20 20 20 20 | 20 20 28 69 66 20 28 7a | | (if (z|
|000060f0| 65 72 6f 3f 20 6e 29 0a | 20 20 20 20 20 20 20 20 |ero? n).| |
|00006100| 20 20 20 20 20 20 20 6c | 0a 20 20 20 20 20 20 20 | l|. |
|00006110| 20 20 20 20 20 20 20 20 | 28 2a 20 6e 20 28 66 61 | |(* n (fa|
|00006120| 63 74 20 28 2d 31 2b 20 | 6e 29 29 29 29 29 0a 20 |ct (-1+ |n))))). |
|00006130| 20 20 20 20 46 41 43 54 | 20 0a 20 20 20 20 20 0a | FACT| . .|
|00006140| 20 5b 31 20 52 45 50 5d | 20 28 66 61 63 74 20 33 | [1 REP]| (fact 3|
|00006150| 29 0a 20 20 20 20 20 55 | 6e 62 6f 75 6e 64 20 56 |). U|nbound V|
|00006160| 61 72 69 61 62 6c 65 20 | 4c 0a 20 20 20 20 20 45 |ariable |L. E|
|00006170| 72 72 6f 72 21 0a 20 20 | 20 20 20 0a 20 5b 32 20 |rror!. | . [2 |
|00006180| 45 72 72 6f 72 5d 20 28 | 64 65 62 75 67 29 0a 20 |Error] (|debug). |
|00006190| 20 20 20 20 53 75 62 70 | 72 6f 62 6c 65 6d 20 4c | Subp|roblem L|
|000061a0| 65 76 65 6c 3a 20 30 20 | 20 52 65 64 75 63 74 69 |evel: 0 | Reducti|
|000061b0| 6f 6e 20 4e 75 6d 62 65 | 72 3a 20 30 0a 20 20 20 |on Numbe|r: 0. |
|000061c0| 20 20 45 78 70 72 65 73 | 73 69 6f 6e 3a 0a 20 20 | Expres|sion:. |
|000061d0| 20 20 20 4c 20 0a 20 20 | 20 20 20 77 69 74 68 69 | L . | withi|
|000061e0| 6e 20 74 68 65 20 70 72 | 6f 63 65 64 75 72 65 20 |n the pr|ocedure |
|000061f0| 46 41 43 54 2e 0a 20 20 | 20 20 20 61 70 70 6c 69 |FACT.. | appli|
|00006200| 65 64 20 74 6f 20 28 30 | 29 0a 0a 20 5b 33 20 44 |ed to (0|).. [3 D|
|00006210| 65 62 75 67 5d 20 73 0a | 20 20 20 20 20 53 75 62 |ebug] s.| Sub|
|00006220| 70 72 6f 62 6c 65 6d 20 | 4c 65 76 65 6c 3a 20 30 |problem |Level: 0|
|00006230| 20 20 52 65 64 75 63 74 | 69 6f 6e 20 4e 75 6d 62 | Reduct|ion Numb|
|00006240| 65 72 3a 20 30 0a 20 20 | 20 20 20 45 78 70 72 65 |er: 0. | Expre|
|00006250| 73 73 69 6f 6e 3a 0a 20 | 20 20 20 20 4c 20 0a 20 |ssion:. | L . |
|00006260| 20 20 20 20 77 69 74 68 | 69 6e 20 50 72 6f 63 65 | with|in Proce|
|00006270| 64 75 72 65 20 46 41 43 | 54 0a 20 20 20 20 20 61 |dure FAC|T. a|
|00006280| 70 70 6c 69 65 64 20 74 | 6f 20 28 30 29 0a 0a 5c |pplied t|o (0)..\|
|00006290| 65 6e 64 7b 73 63 68 65 | 6d 65 7d 0a 54 68 65 20 |end{sche|me}.The |
|000062a0| 63 6f 6d 6d 61 6e 64 20 | 7b 5c 74 74 20 53 7d 20 |command |{\tt S} |
|000062b0| 64 69 73 70 6c 61 79 73 | 20 74 68 65 20 63 75 72 |displays| the cur|
|000062c0| 72 65 6e 74 20 73 75 62 | 70 72 6f 62 6c 65 6d 2e |rent sub|problem.|
|000062d0| 20 20 54 68 65 20 63 6f | 6d 6d 61 6e 64 0a 7b 5c | The co|mmand.{\|
|000062e0| 74 74 20 42 7d 20 6d 6f | 76 65 73 20 62 61 63 6b |tt B} mo|ves back|
|000062f0| 77 61 72 64 73 20 69 6e | 20 74 69 6d 65 2e 0a 5c |wards in| time..\|
|00006300| 62 65 67 69 6e 7b 73 63 | 68 65 6d 65 7d 0a 20 5b |begin{sc|heme}. [|
|00006310| 33 20 44 65 62 75 67 5d | 20 62 0a 20 20 20 20 20 |3 Debug]| b. |
|00006320| 53 75 62 70 72 6f 62 6c | 65 6d 20 4c 65 76 65 6c |Subprobl|em Level|
|00006330| 3a 20 30 20 20 52 65 64 | 75 63 74 69 6f 6e 20 4e |: 0 Red|uction N|
|00006340| 75 6d 62 65 72 3a 20 31 | 0a 20 20 20 20 20 45 78 |umber: 1|. Ex|
|00006350| 70 72 65 73 73 69 6f 6e | 3a 0a 20 20 20 20 20 28 |pression|:. (|
|00006360| 49 46 20 28 5a 45 52 4f | 3f 20 4e 29 20 4c 20 28 |IF (ZERO|? N) L (|
|00006370| 2a 20 4e 20 28 46 41 43 | 54 20 28 2d 31 2b 20 4e |* N (FAC|T (-1+ N|
|00006380| 29 29 29 29 20 0a 20 20 | 20 20 20 77 69 74 68 69 |)))) . | withi|
|00006390| 6e 20 50 72 6f 63 65 64 | 75 72 65 20 46 41 43 54 |n Proced|ure FACT|
|000063a0| 0a 20 20 20 20 20 61 70 | 70 6c 69 65 64 20 74 6f |. ap|plied to|
|000063b0| 20 28 30 29 0a 20 20 20 | 20 20 0a 20 5b 33 20 44 | (0). | . [3 D|
|000063c0| 65 62 75 67 5d 20 62 0a | 20 20 20 20 20 53 75 62 |ebug] b.| Sub|
|000063d0| 70 72 6f 62 6c 65 6d 20 | 4c 65 76 65 6c 3a 20 30 |problem |Level: 0|
|000063e0| 20 20 52 65 64 75 63 74 | 69 6f 6e 20 4e 75 6d 62 | Reduct|ion Numb|
|000063f0| 65 72 3a 20 32 0a 20 20 | 20 20 20 45 78 70 72 65 |er: 2. | Expre|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.